Tuesday, July 10, 2012

ssh without password

NFS mount /home/shi then have rodin or rodin2 rsa.pub in authorized_keys and authorized_keys2 ############### SSH Login No Password Prompt By adminPublished: January 6, 2010 at 1:14 PMTags: Sometimes on Linux, you want to automatically login to a machine using ssh without being prompted for a password. How do you set this up? First you need to generate a public/private key pair on the server you will be connecting from, lets call it SERVERFROM ssh-keygen -t rsa You could also use -t dsa as well. Next you will be prompted for the directory to create the key pair in, just hit enter to accept the default. [root@serverfrom ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/root/.ssh/id_rsa): Next you are prompted for a password. In this case, you don’t want a password so just hit enter twice. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_rsa.pub. The key fingerprint is: c5:72:ee:10:f3:8e:ca:98:da:46:85:01:11:08:ba:75 root@serverfrom Now you have a public/private key pair. Your private key is in the file: /root/.ssh/id_rsa & your public key file is in /root/.ssh/id_rsa.pub Now, in order to get ssh to work without prompting for a password, you need to copy your public key to the server you want to connect to. Lets say the server you want to connect to is called SERVERTO, then on SERVERFROM you would do: scp /root/.ssh/id_rsa.pub root@SERVERTO:/root/.ssh/authorized_keys2 If you already have an authorized_keys2 file on SERVERTO, then just append the new key to the end of it by copying the key to SERVERTO and then appending it like: scp /root/.ssh/id_rsa.pub root@serverto:/root/.ssh/id_rsa.pub Then on the SERVERTO server, just concatenate the file id_rsa.pub to the authorized_keys2 file like: cd /root/.ssh cat id_rsa.pub >> authorized_keys2 Now, you should be able to scp or ssh from SERVERFROM to SERVERTO without supplying a password: [root@serverfrom ~]# ssh serverto Last login: Wed Jan 6 09:09:21 2010 from serverfrom.domain.org [root@serverto ~]#

NFS auto mount not working

copy from http://forums.opensuse.org/english/get-technical-help-here/hardware/419781-nfs-share-wont-automount.html Code: #!/bin/bash #echo "$0: This is it" m1=$( mount |grep 192.168.1.10:/home/backup -c ) m2=$( mount |grep 192.168.1.10:/mnt/sdb1/Data -c ) if test $m1 -eq 1 && test $m2 -eq 1 then echo 1 else echo 0 fi , the second script I did is to mount the nfs folders Code: #!/bin/bash mount 192.168.1.10:/home/backup /media/backup mount 192.168.1.10:/mnt/sdb1/Data /media/Data Then I added new line in /etc/crontab like this Code: */5 * * * * root /home/arcull/nfs_not_mounted && /home/arcull/nfs_mount

NFS post-mount issues

user name not recognized. First mount then login as root, creating user in cluster node. look at /etc/passwd and /etc/group for this user name and configure the same setting as the cluster master server. cannot find name for group ID look for the /etc/group

Monday, July 09, 2012

NFS - mount /home could not chdir to home direcotry: permission denied

 symptom
[root@garl-amd1 ~]# ssh akshay@garl-amd5
akshay@garl-amd5's password:
Last login: Mon Jul 26 02:02:38 2010 from garl-amd1
Could not chdir to home directory /home/akshay/: Permission denied
[akshay@garl-amd5 /]$ cd
[akshay@garl-amd5 akshay]$

This could be selinux related, there is a quick way to check by switching selinux into permissive mode rather than enforcing.

if you edit the file

/etc/sysconfig/selinux
 SELINUX=permissive and rebooted my machine

OR (I did)
setsebool -P use_nfs_home_dirs=1
 
OR
restorecon /home