Preventing access to the SSH server:
The best and most secure practice of running an SSH server is to tighten the hatches as much as possible. In this example, I will show you how to edit your sshd_config file and allow only certain users (except “joe”) to access the system via SSH. Now, lets say that you want to prevent the user “joe” from logging into SSH, but you still want him to be able to access the machine via FTP. Here is what you would do:
Edit /etc/ssh/sshd_config
Ex: vim /etc/ssh/sshd
Add a line that says AllowUsers
Ex: AllowUsers adamk tim sean jacob dave
Note that joe is not included here.
Save the sshd_config file.
Restart your sshd daemon.
Another (quick) way to do this in one simple command is:
echo “AllowUsers adamk tim sean jacob dave” >> /etc/sshd/sshd_config
Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts
Wednesday, February 24, 2010
Thursday, February 12, 2009
How to use SSH in Ubuntu
Let's set it up first...
1. Type sudo aptitude install ssh to install ssh service
2. select "yes" for install to proceed
Now how to connect to your Ubuntu ssh enabled machine...
1. type ssh username@ipaddr or username@domainname
2. If it's the first time to connect to your computer a verification will prompt you to validate it.
3. if you choose "yes" and the password you entered is correct the login on your ubuntu pc should show.
To check the logged on Users in your Ubuntu PC...
1. just type who -u to see the connected users in you machine
1a. sample output:
rorfano tty7 2009-02-05 09:52 . 6539 (:0)
rorfano pts/0 2009-02-06 17:18 . 26248 (:0.0)
this means that there are no users connected to my machine.
2a. sample output:
rorfano tty7 2009-02-05 09:52 . 6539 (:0)
rorfano pts/0 2009-02-06 17:18 . 26248 (:0.0)
rorfano pts/1 2009-02-12 10:34 . 6508 (tenchi.local)
this means that the machine "tenchi.local" is connected to my machine.
To check the log...
1. Just type tail /var/log/auth.log | grep "Accepted password"
1a. sample output:
Feb 12 10:17:48 Ichigo-pc sshd[6223]: Accepted password for rorfano from 192.168.10.100 port 5061 ssh2
2. as the ssh is used more often the log file will pile up with these lines.
3. as a security measure often check this log to see if there's an intruder logged-on in your machine.
have fun!
1. Type sudo aptitude install ssh to install ssh service
2. select "yes" for install to proceed
Now how to connect to your Ubuntu ssh enabled machine...
1. type ssh username@ipaddr or username@domainname
2. If it's the first time to connect to your computer a verification will prompt you to validate it.
3. if you choose "yes" and the password you entered is correct the login on your ubuntu pc should show.
To check the logged on Users in your Ubuntu PC...
1. just type who -u to see the connected users in you machine
1a. sample output:
rorfano tty7 2009-02-05 09:52 . 6539 (:0)
rorfano pts/0 2009-02-06 17:18 . 26248 (:0.0)
this means that there are no users connected to my machine.
2a. sample output:
rorfano tty7 2009-02-05 09:52 . 6539 (:0)
rorfano pts/0 2009-02-06 17:18 . 26248 (:0.0)
rorfano pts/1 2009-02-12 10:34 . 6508 (tenchi.local)
this means that the machine "tenchi.local" is connected to my machine.
To check the log...
1. Just type tail /var/log/auth.log | grep "Accepted password"
1a. sample output:
Feb 12 10:17:48 Ichigo-pc sshd[6223]: Accepted password for rorfano from 192.168.10.100 port 5061 ssh2
2. as the ssh is used more often the log file will pile up with these lines.
3. as a security measure often check this log to see if there's an intruder logged-on in your machine.
have fun!
Subscribe to:
Posts (Atom)