The screen program, among other useful things, lets you keep an SSH session running even after you disconnect from SSH. Here’s how to use it.
SSH in.
ssh user@hostname.com
Once on the remote machine, set up a named screen:
screen -S myscreen
In another terminal, open another SSH connnection and start another screen:
screen -S mysecondscreen
You can see they are there by using, in either of the terminals,
screen -ls
This does NOT start screen, just lists the different screens.
You can now disconnect the SSH connections. When you reconnect, you can use
screen -r myscreen
or
screen -r mysecondscreen
to reconnect to the one you want.
Some easy ways to configure SSH to be a little more secure:
Edit /etc/ssh/sshd_config as root.
- Change the port (default is 22)
- Change “PermitRootLogin yes” to “PermitRootLogin no”
- AddUser username
- save and quit
- restart the ssh server: sudo /etc/init.d/ssh restart
More info here:
http://ubuntu-tutorials.com/2007/02/14/what-you-ought-to-know-about-securing-ssh/
Easy way to add public key of this machine to a remote machine:
ssh-copy-id -i ~/.ssh/id_dsa.pub root@fileserver01
More good info here:
http://ubuntu-tutorials.com/2007/02/05/unattended-ssh-login-public-key-ssh-authorization-ssh-automatic-login/
Published on
January 9, 2008 in
linux and ssh.
sudo vim /etc/ssh/sshd_config
Published on
January 9, 2008 in
linux and ssh.
sudo /etc/init.d/ssh restart
Published on
December 10, 2007 in
linux and ssh.
cat /var/log/auth.log | grep sshd
To check the zipped ones, use
zcat /var/log/auth.log.1.gz | grep sshd