Deny ssh access to one user

18 05 2017

If you want to deny the access of one user (or group) to a server via ssh, these are the steps for a Debian/Ubuntu server:

Add the user to /etc/security/access.conf
- : user1 : ALL

Assure that “/etc/ssh/sshd_config” have the following line (by default yes):
UsePAM yes

Assure that “/etc/pam.d/sshd” have uncommented the following line:
account required pam_access.so





Ssh error Too many authentication failures for root

8 02 2017

ssh -o PubkeyAuthentication=no root@host





Linode ssh login problem

14 12 2016

If you try to connect to a Linode server by ssh and receive the following message:

Received disconnect from 1.1.1.1: 2: Too many authentication failures

It’s related to the ssh keys, try again with the following argument:

ssh -o PubkeyAuthentication=no user@1.1.1.1

More info:
http://superuser.com/questions/187779/too-many-authentication-failures-for-username





Run ssh-agent at login and load keys with an alias

27 07 2016

Add the following lines to the “~/.bashrc” for start automatically the ssh-agent service in each login and create and alias for load the keys and write the passphrase:

if [ -z "$SSH_AUTH_SOCK" ] ; then
eval `ssh-agent -s`
fi
alias ssh-keys='ssh-add ~/.ssh/name_of_key_one ~/.ssh/name_of_key_two'






Find duplicate IPs inside a subnet

14 10 2015

When a IP address is duplicate in a subnet, if there is a ssh connection to problematic server, the message “Write Failed: broken pipe” usually appears.

For find the MAC address of both hosts, the following command will report them:

# arping -I eth0 -c 3 192.168.0.1

If the result only report one MAC, the problem probably will be in other place.





Keep ssh keys in xfce session

8 05 2015

For have the same behaviour with the ssh keys than in Gnome, write it the first time and keep cached until the end of the session, follow this steps:

Under “Sessions and Startup” menu, add a new “Application Autostart” with:
Name: Keyring
Command: gnome-keyring-daemon --start

Under tab “Advanced” allow:
Launch GNOME services on startup

Finally, restart session.