Friday, May 9, 2014

SSH passwordless login: Solaris 10

root@solaris01: / $ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (//.ssh/id_dsa):
Created directory '//.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in //.ssh/id_dsa.
Your public key has been saved in //.ssh/id_dsa.pub.
The key fingerprint is:
1d:c6:10:63:39:db:2c:69:8a:cc:c4:ae:75:15:74:b6 root@solaris02
root@solaris02: / $ ll
total 981

root@solaris01: .ssh $ cat id_dsa.pub
ssh-dss AAAAB3NzaC1kc3MAAACBANZP8v0o/NFHt+1Tu3BISCnKoJ4SqonlAZcTm25sT1zbrmCSjv1WDa54/fuRDmqsavIymj+HmGAK1pNmh8ThuKTqznGpA+6BW7tJXG6EIB1+5iZPMkIhRJzDIvWycGumG/BjKvCdLus3rtKaV6ShAmYUZhsFHetepGfWFdQhr7i9AAAAFQCPqVyVY4XjhzaK2KkRSl1r3IjDkQAAAIBLSn4I6BR2SOqYIH3WL2herepkTr5f3y+hzLjpI91S6MEcj9XljjAg9M8TQPPMImWlKnOl/2A3JGeeH79fUVUeLIBobDJ2wyJZyiDdFPhkCpGGfwHaNhc+a81YutgiVXMS5VmmSmmFgAAAIAUQT27kUeBa4hrbYaHAdzeAACNjlf5ODXBcsmuJTaEW2D2sroeJ1pfsEiL/BhJlpX99NT6HsuxYM4GO1zutFv3TX97YMrKJRa2Yxy5cRlGLoStmTRhktyXDbdHpWALsutMyocFIkLZTte0e1fL9zMWNbCg2qzl+oiUFyw9o9tX+A== root@solaris01

on solaris02 host:

chmod go-w /.ssh

paste this key in the autorized_keys on solaris02 

save the file and initiate the passwordless login

root@solaris01: / $ ssh solaris02
Last login: Fri May  9 18:09:24 2014 from solaris01
Oracle Corporation      SunOS 5.10      Generic Patch   January 2005
root@solaris02: / $

thats it.


change hostname in solaris 10 after fresh install.

1. backup the /etc/hosts and /etc/hostname.interface files.
2. add the hostname entry in the /etc/hosts file.
3. mv the old /etc/hostname.interface to /etc/new_hostname.interface
4. on the command line hostname hostname
 exit from the terminal and login back. You should see the new hostname now.

Change the PS1 value for the login prompt:

PS1="\u@\h: \W $ "

Crontab in solaris 10

A little different in solaris 10 while editing the cron job.

You will have to export the vi editor and then edit the crontab file.

   #  EDITOR=vi
   # export EDITOR
   # crontab -e

#ident  "@(#)root       1.21    04/03/23 SMI"
#
# The root crontab should be used to perform accounting data collection.
#
#
10 3 * * * /usr/sbin/logadm
15 3 * * 0 /usr/lib/fs/nfs/nfsfind
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean
#
# The rtc command is run to adjust the real time clock if and when
# daylight savings time changes.
#
1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1
#10 3 * * * /usr/lib/krb5/kprop_script ___slave_kdcs___
0 22 21,10 * * "Testing crontab" > /dev/console

 wq! and the save the file

-bash-3.2# crontab -l
#ident  "@(#)root       1.21    04/03/23 SMI"
#
# The root crontab should be used to perform accounting data collection.
#
#
10 3 * * * /usr/sbin/logadm
15 3 * * 0 /usr/lib/fs/nfs/nfsfind
30 3 * * * [ -x /usr/lib/gss/gsscred_clean ] && /usr/lib/gss/gsscred_clean
#
# The rtc command is run to adjust the real time clock if and when
# daylight savings time changes.
#
1 2 * * * [ -x /usr/sbin/rtc ] && /usr/sbin/rtc -c > /dev/null 2>&1
#10 3 * * * /usr/lib/krb5/kprop_script ___slave_kdcs___
0 22 21,10 * * "Testing crontab" > /dev/console

thats it.