Posts Tagged shell
Merge many depots
Posted by Lincoln Zuljewic Silva in HP-UX on August 25, 2009
When you have many depot files, you can create a single big depot and install it instead of install one by one. Let’s assume that you need install the following depots, and they are all located in the directory /tmp/install/depots:
autoconf-2.64-hppa-11.11.depot bison-2.4.1-hppa-11.11.depot gawk-3.1.7-hppa-11.11.depot sed-4.2.1-hppa-11.11.depot tcltk-8.5.7-hppa-11.11.depot texinfo-4.13-hppa-11.11.depot zip-3.0-hppa-11.11.depot
To create a single depot, run the follow commands:
# cd /tmp/install/ for i in `ls depots/*.depot` ;do swcopy -s /tmp/install/$i \* @/tmp/install/big;done
Now, to install it, you can use:
# swinstall -s /tmp/install/big
rlogin access denied
Posted by Lincoln Zuljewic Silva in Linux on June 15, 2009
In some specific situations, you need use rlogin to remote access a server, but you can face the following error:
clientServer:~ # rlogin rloginServer
Password:
Password:
Login incorrect
login: root
Password:
Login incorrect
login: root
Password:
Login incorrect
login: root
Password:
Login incorrect
rlogin: connection closed.
If you check the /var/log/secure log on the “rloginServer”, you will find the following messages:
Jun 15 10:44:41 rloginServer rlogind[16640]: pam_securetty(rlogin:auth): access denied: tty 'rlogin' is not secure !
Jun 15 10:44:41 rloginServer rlogind[16640]: pam_rhosts_auth(rlogin:auth): denied to root@10.11.4.9 as root: access not allowed
Jun 15 10:44:47 rloginServer login: pam_securetty(remote:auth): access denied: tty 'pts/0' is not secure !
Jun 15 10:44:51 rloginServer login: FAILED LOGIN 1 FROM 10.11.4.9 FOR root, Authentication failure
Jun 15 10:44:53 rloginServer login: pam_securetty(remote:auth): access denied: tty 'pts/0' is not secure !
Jun 15 10:44:58 rloginServer login: FAILED LOGIN 2 FROM 10.11.4.9 FOR root, Authentication failure
Jun 15 10:44:58 rloginServer login: pam_unix(remote:auth): bad username []
Jun 15 10:44:58 rloginServer login: pam_succeed_if(remote:auth): error retrieving information about user
Jun 15 10:44:58 rloginServer login: FAILED LOGIN 3 FROM 10.11.4.9 FOR , User not known to the underlying authentication module
Jun 15 10:44:59 rloginServer login: pam_unix(remote:auth): bad username []
Jun 15 10:44:59 rloginServer login: pam_succeed_if(remote:auth): error retrieving information about user
Jun 15 10:44:59 rloginServer login: FAILED LOGIN SESSION FROM 10.11.4.9 FOR , User not known to the underlying authentication module
The problem here, is that “rlogin” is not a “secure” shell. To configure it, you should add “rlogin” (without the quotes) to /etc/securetty .
After that, you will be able to access the rlogin server.
Setting session timeout on Linux
Posted by Lincoln Zuljewic Silva in Linux on May 27, 2009
To set an automatically shell timeout on Linux (that Will logoff that session after X seconds), you just need setup the following variable (put it in your /etc/profile):
# echo “TMOUT=300; readonly TMOUT; export TMOUT” >> /etc/profile
The “readonly” option will not allow an normal user change (ou unset) it.
Rotate log files in Linux
Posted by Lincoln Zuljewic Silva in Linux on May 15, 2009
An easy way (shell script) to rotate log files in Linux can be:
#!/bin/bash
# Include the following line in crontab:
#00 5 * * * /bin/rotate_logs.sh > /dev/null 2>&1
#
DATE=`date "+%Y%m%d"`
cd /var/log/
for i in messages secure cron lastlog
do
cp ${i} ${i}.${DATE}
> ${i}
gzip -9 ${i}.${DATE}
done
/etc/init.d/syslog restart
If you have any other log to rotate, you can change the line 8 and 10.
Disable CTRL+C on Linux
Posted by Lincoln Zuljewic Silva in Linux on April 30, 2009
To disable CTRL+C on Linux, you can use the following command:
# stty intr undef