ssh -C -X email@example.com gnome-terminal
> vi /etc/ssh/sshd_config
> vi /etc/ssh/ssh_config
> /etc/init.d/ssh restart
You done and can connect with forwarding
Auto login via ssh
- Create a public ssh key, if you haven’t one already.
ssh-keygen will create key as.ssh/id_rsa
- Make sure your
.sshdir is 700:
chmod 700 ~/.ssh
- Get your public ssh key on the server you want to login automatically.
scp ~/.ssh/id_rsa.pub firstname.lastname@example.org:is ok.
- Append the contents of your public key to the ~/.ssh/authorized_keys and remove it.
Important: This must be done on the server you just copied your public key to. Otherwise you wouldn’t have had to copy it on your server.
Simply issue something like
cat id_dsa.pub >> .ssh/authorized_keyswhile at your home directory.
- Instead of steps 3 and 4, you can issue something like this:
cat ~/.ssh/id_rsa.pub | ssh -l remoteuser remoteserver.com 'cat >> ~/.ssh/authorized_keys'
- Remove your public key from the home directory on the server.
sudo vi /etc/ssh/sshd_config
change or add
Reverse SSH or Tunnel sshSSH is one of the most versatile tools for Linux, but most people only ever use it one way - to use the server to send data to the client. What you might not know is that it's also possible to switch the usual logic SSH and use the client to send data to the server. It seems counterintuitive, but this approach can save you having to reconfigure routers and firewalls, and is also handy for accessing your business network from home without VPN.
You'll need the OpenSSH server installed on your work machine, and from there you need to type the following to tunnel the SSH server port to your home machine:
ssh -R 1234:localhost:22 home_machineYou'll need to replace home_machine with the IP address of your home machine. We've used port number 1234 on the home machine for the forwarded SSH session, and this port needs to be both free to use and not blocked by a local firewall. Once you've made the connection from work, you can then type the following at home to access your work machine:
ssh workusername@localhost -p 1234This will open a session on your work machine, and you will be able to work as if you were at the office. It's not difficult to modify the same procedure to access file servers or even a remote desktop using VNC. The only problem you might find is that the first SSH session may time out. To solve this, open /etc/ssh/sshd.conf on your work machine and make sure it contains 'KeepAlive yes' and 'ServerAliveInterval 60' so that the connection doesn't automatically drop.
this part was adopted from