↑ Top
dev studios
| Sign in | DE EN


Secure Shell - remote access with Linux

In Linux systems is a remote access very easy. Everything needed is the SSH which is a default. The remote system needs the additionall package "openssh-server" installed. To connect use

ssh user@hostname
# or
ssh user@ip

If you don't want to enter the password everytime you need to generate and publish a key

ssh-keygen -t rsa
# enter no passphrase
cat .ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

(If there is an error check if the .ssh folder exists and create it if needed. Or if it says something has changed check if your local system has a new IP or hostname.)

Use cases

If you want to run a GUI app on the remote system and display it locally add "-X" to your ssh command.

And if you want to use the remote system as socks proxy for your internet traffic use "-D 8080" (8080 is the network port).

To copy files to the remote system use "scp" instead of "ssh" in your command line like (the reversed way works too)

scp localfolder/file user@hostname:folder/

And you can even mount a remote folder to your local system with the additional package "sshfs"

sshfs user@hostname:/folder localfolder/

If you use sshfs together with rsync be aware that you mounted it with specific user rights. You can't simply use chown. rsync -a will result in

rsync: chown "/mnt/file" failed: Permission denied (13)

This will also have wrong timestamps as result. But you can avoid it by using "rsync -rlptD".



(Edited 16-07-19)