# ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pubwhere -y output the public key
References:
Linux Toolkits Blog is a scratch-pad of tips and findings on Linux
# ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pubwhere -y output the public key
# vim /etc/ssh/sshd_config
# Ciphers Ciphers aes128-cbc,aes192-cbc,aes256-cbc,blowfish-cbc,arcfour KexAlgorithms diffie-hellman-group1-sha1*If you are using Centrify-OpenSSH, you have to modify /etc/centrifydc/ssh/sshd_config and do the same
# ssh-keygen -l -f id_rsa.pub
2048 .................................................... yournode@headnode.com
# ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa
# vim /etc/ssh/sshd_config
..... ClientAliveInterval 60 .....
# vim ~/.ssh/config
..... ServerAliveInterval 60 .....
Sep 17 12:00:00 node1 sshd[4725]: error: PAM: Authentication failure for user2 from 192.168.1.5 Sep 17 12:00:01 node1 adclient[7052]: WARN audit User 'user2' not authenticated: while getting service credentials: No credentials found with supported encryption
# service /etc/init.d/centrifydc restart # service /etc/init.d/centrify-sshd restart
# ssh -v remote-hostyou will see an errors similar to such as those below:
debug1: Unspecified GSS failure. Minor code may provide more information Unknown code krb5 195OR
debug1: Miscellaneous failure No credentials cache foundTo reinstate the password-less access to compute nodes, you have to do the following. First thing first, please do backup files at your ~/.ssh/
# cd ~/.ssh/
# cat id_rsa.pub >> authorized_keys
# chmod 400 /home/myuser/.ssh/authorized_keys
..... debug1: Authentications that can continue: publickey,gssapi-with-mic,password debug1: Next authentication method: gssapi-with-mic debug1: Unspecified GSS failure. Minor code may provide more information Unknown code krb5 195 debug1: Unspecified GSS failure. Minor code may provide more information Unknown code krb5 195 debug1: Unspecified GSS failure. Minor code may provide more information Unknown code krb5 195 debug1: Next authentication method: publickey debug1: Trying private key: /home/user1/.ssh/identity .....
$ vim ~/.ssh/config
GSSAPIAuthentication no
# /etc/ssh/sshd_config
GSSAPIAuthentication no
# w
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT ..... user1 pts/31 :24.0 08Oct12 22days 0.05s 0.05s -bash user2 pts/24 :30 02Jan13 2days 0.66s 0.66s -bash user3 pts/55 :17 12Nov12 59days 0.01s 0.01s -bash .....
# ps -aux |grep 'pts/31' Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ root 27552 0.0 0.0 61172 776 pts/1 S+ 00:41 0:00 grep pts/31 546 30050 0.0 0.0 64188 1516 pts/31 Ss+ 2012 0:00 -bash
# kill -9 30050
# sshpass -f password.txt ssh-copy-id user@remoteserver
Host * ControlMaster auto ControlPath ~/.ssh/master-%r@%h:%pControlMaster auto Tries to start a master if there is no existing connection or it will use an existing master connection. ControlPath is the location socket for the ssh processes to communicate among themselves. The %r, %h and %p are replaced with your user name, the host to which you're connecting and the port number—only ssh sessions from the same user to the same host on the same port can or should share a TCP connection, so each group of multiplexed ssh processes needs a separate socket.
........... debug1: setting up multiplex master socket debug1: channel 0: new [client-session] ...........
.................... debug1: auto-mux: Trying existing master ...................
.......pbs_mom: LOG_ERROR::sys_copy, command '/usr/bin/scp -rpB 2014.Head-Node.OU userid@headnode:/home/xxx' failed with status=1, giving up after 4 attempts
MaxStartups 100
$ ssh -v ip_of_remote_server
..... debug1: Unspecified GSS failure. Minor code may provide more information Unknown code krb5 195 debug1: Unspecified GSS failure. Minor code may provide more information Unknown code krb5 195 debug1: Unspecified GSS failure. Minor code may provide more information Unknown code krb5 195 .....
Protocol 2
HostKey /etc/ssh/ssh_host_key PidFile /var/run/sshd.pid
StrictModes yes
Port 22 ListenAddress 0.0.0.0 TcpKeepAlive yes
UseDNS no
LoginGraceTime 30
PubkeyAuthentication yes PasswordAuthentication no PermitEmptyPasswords no RSAAuthentication yes RhostsRSAAuthentication no HostbasedAuthentication no KerberosAuthentication no ChallengeResponseAuthentication yes GSSAPIAuthentication no IgnoreRhosts yes
AllowGroups users AllowUsers me_only DenyGroups black_list DenyUsers hacker_idFor more information, see How do I permit specific users SSH access?
AllowTcpForwarding yes X11Forwarding yes
# tail -50 /var/log/secure
Sep 6 10:15:42 santol-h00 sshd[4268]: Accepted password for root from 192.168.1.191 port 51109 ssh2 Sep 6 10:15:52 santol-h00 sshd[4268]: pam_unix(sshd:session): session opened for user root by (uid=0)
# vim /etc/ssh/sshd_config
#ShowPatchLevel no UseDNS no #PidFile /var/run/sshd.pid
# service sshd restart
# vim /etc/ssh/sshd_config
# Subsystem sftp /usr/lib/openssh/sftp-server# service sshd restart
# /etc/ssh/sshd_config
ClientAliveInterval 15 ClientAliveCountMax 3