How to export DISPLAY onto another linux host's Xserver - linux

I use Xming for running Xserver on windows machine and that works just fine.
export DISPLAY=<windows_host_IPAddr>:0.0
But I want to export display onto another linux host.
export DISPLAY=<linux_host_IPAddr>:0.0
I am running opensuse and I think Xorg should do the job. But I could not figure out what exactly needs to be done.
If there are any other Xming equivalent packages for linux, please let me know. Thanks in advance.

The only thing you have to do is to enable remote X sessions on your SuSe box. So, login at the desktop, open a shell, and type:
xhost +<IP_address_of_server>
Where IP_address_of_server is the address of the machine where you are starting your actual program (so you allow incoming X connections).
However, this is not very secure, so a better option may be to use SSH and X-forwarding. Again, on your SuSe box, open a terminal and type
ssh -X <account>#<IP_address_of_server>
Then, in the ssh session start your X program without any DISPLAY options, and the output should appear on your local desktop.
In case you have trouble with the -X option, you may try the -Y one, but see the manual page of ssh for details.

Related

Ubuntu server login loop in shell after deleting zsh

I have a PC I'm using as a linux server (Ubuntu 16.10), to which I ssh / run nginx etc. Today I tried to remove zsh (the default shell, via apt-get purge) hoping it would default back to either to bash or fish shell. Instead, I now cannot ssh into the server (wrong password), and when I use the same password to login directly to the server (as in not via ssh, literally hooking up the server to a monitor) it flashes some text and prompts me to login again.
I've tried holding shift on boot, didn't do anything.
Also, no FTP.
And I don't have a password for the root user or any other user.
I'd heavily prefer not to wipe the whole server, Is there a way I can access it and fix it?
Thanks in advance.
As #Maadinsh said, this is the correct answer:
Boot into a linux liveCD (Ubuntu liveCD, etc.)
Mount the Linux system partition (The boot looped Ubuntu-Server, not the liveCD ubuntu / other distro)
cd into /etc/ and chmod passwd to let you edit it
Change the default shell for your user (at the end of the line) from the nonexisting shell to an existing one.
Save passwd
Reboot the server.

Change size of files on Windows machine from remote Linux machine

I need to change somehow size of files (increase or decrease) on Windows machine using bash scripts. (Content of files doesnt matter) But i have to run this scripts from remote linux machine. I've selected truncate command for size changing, this is exactly that i need, cause i need to change size exactly of chosen file, without changing it's descriptor. It is very important.
But i DO NOT have truncate on my linux machine and i CANNOT install it there (So dont tell me to install it there plz :)). I cannot install nothing on my linux machine it has specific kernel - this is a main option of all my problems.
So i've decided to install cygwin on my Windows machine, cause it has truncate command. Also i know that there are fallocate command, but my linux machine also doesnt have it, and cygwin doesnt have it too. So if there is some another command i wanna know it :)
Then after this steps i tried to change file size from cygwin terminal via truncate and all works perfectly. And the last problem that i had to solve was just run cygwin's bash from my remote linux, i've chosen winexe for that.
Finally the way that i've chosen is:
I run winexe command on my linux machine that runs:
winexe myHost "c:\cygwin\bin\bash.exe myScriptWithTRUNCATE"
on my Win machine.
But it doesnt work and i dunno why. truncate command doesnt change size of files at all. When i type
truncate --help
all works, i can see result of help option on my linux terminal, but e.g.
truncate -s someSize myFile
doesnt work, size of file doesnt change. Also error code from truncate -s someSize myFile is 0
Any suggestions?
try giving the name of your script that is "myScriptWithTRUNCATE" directly in winexe command .
example:-
winexe myHost "c:\cygwin\bin\bash.exe myScriptWithTRUNCATE"
also check debug log of winexe by modifying winexe command as :-
winexe -d 5 myHost "c:\cygwin\bin\bash.exe myScriptWithTRUNCATE"
see in this log what actually is sent over to windows as command in place for your script.
specifically see in " CTRL: sending command : run xxxxx"
see what "xxxxx" is in that debug log.
winexe gives you the control of windows command line(cmd.exe).
Try running you script after it has got control of cmd.exe.
Based on some findings above , try this link for more help
http://blog.dotsmart.net/2011/01/27/executing-cygwin-bash-scripts-on-windows/

Using rlwrap with an ssh session

I am using SSH to login to an ubuntu server. However, I am not able to use commands such as tab auto-complete, or using arrow keys to view previous history. I have installed rlwrap on the remote machine and on my local directory. I was wondering if there was any way to use rlwrap to allow me to use these shortcuts on the server (or something else). The server is running Ubuntu Server edition 10.0.4.
Check your shell on the remote server, change it to /bin/bash if it is not
chsh /bin/bash
I have some difficulty understanding your question (e.g. what commands are you running on the remote server? What is your local directory and how does one install rlwrap on it?. Does the input history of your login shell work properly?)
In general:
When an interactive command doesn't have a usable (by way of the arrow keys) input history, type rlwrap in front of the command name. E.g.: rlwrap sqlplus instead of just sqlplus
If you cannot use your arrow keys at all, even in your login shell, something is wrong with your installation. In that case you'll have to ask the remote machine's system administrator to help you. You could run rlwrap ssh remote.host from a shell prompt on your local machine as a stop-gap measure

When SSHing into system, is there a way to launch netbeans from command-line like I do VIM?

VIM seems integrated to the terminal. Can I open a remote file from the command-line with netbeans? Does it have shell integration? Any further explanation on this so I can better conceptually understand it would be very appreciated.
Few options:
Using ssh -X to forward X. Then you
can start netbeans remotely.
Use sshfs so you mount the
remote filesystem locally over ssh.
You can use then local copy of
netbeans to work on remote files.
Using rsync to have a local copy
The best one - use version control
Yes, you can, providing certain conditions are met!
Using ssh, you can tunnel the display of X-Window applications, meaning you can run the application (the X-Client) on one machine, and have it display on another (the X-Server).
You'll need to launch ssh with the -X option (or -Y, but preferably -X) to allow tunnelling, and then run NetBeans from the commandline as usual:
netbeans MyFile.java
Read about X-forwarding. The link points to a very verbose and detailed howto/tutorial.

Running XWindow programs in Cygwin

I installed all the necessary packages for running GUI programs in Cygwin.
Right now, I have to do these things to launch an XWindow program:
1) /bin/startxwin.sh
2) It starts a separate window (the X Window?)
2) In that X Window, ssh -X user#server (this is the remote box where I want to run that box's programs)
3) Then in that X Window, I can launch GUI programs like "xclock".
My question is, can I directly do ssh -X user#server under my original Cygwin window, and launch GUI programs directly, instead of launching a separate X Window and doing it there?
Any instructions are appreciated!!!!
If you want a nice GUI , AFAIK you need an X server to display graphics from your remote "X client".
If what bother you is to manually lauch the X server (?) you may still launch your X server at startup. On my work desktop I do that personnaly (while it don't use X server provided by Cygwin but a commercial one).
Edit: accordinly to the whole comments, You must try with : export DISPLAY=xxx:0.0 , xxx being you the IP address of the machine hosting the x server and add it in your .profile file (or .bashrc file should be fine, but I remember .profile is better for that kind of stuff, nevertheless I may wrong ..)
No, you have to launch X Window server (run startxwin.sh).
"ssh -X" is actually not nesessary. You can set environment variable like
export DISPLAY=Cygwin:0.0
in normal cygwin window then launch GUI programs directly.

Resources