Sunday, May 24, 2009

Linux Tricks

Here are a few tricks which I have learnt in past from different sources.
  • Create two file with same name : Have you ever seen two files with same name in same folder???.... Well I don't think so...Here is how to make two file with same name. Create the folder where you want to make these files. cd to this folder. Now type this $ touch "aditya" and $ touch "aditya ". Obviously most of the people are not able to notice the space after aditya and will definately bang their head on wall or complain that there is a bug in Linux.
  • Allow root to do remote login : If you have done telnet then perhaps you must be aware that root cannot telnet directly. He has to login as a normal user and then type $ su - then the password. But if you want root to login directly from login screen then edit the file securetty present in /etc and add the pts/x terminal from where you want to login, here x is the terminal number.
  • Change the Pre-Login message : To change the message displayed on the login screen of command line login, go to /etc and edit the issue file. Just type the message you want and restart the computer.
  • Change the post-login message : If you want to display a message just after the user logs in then just edit the motd file present in the /etc directory.
  • Do not allow any users to login : If you do not want any user to login in your server then just change the permission of passwd file present in /etc by typing # chmod 700 /etc/passwd. Alternatively you can also edit the passwd file but be extremely careful. You can also create a file called nologin.txt in /etc folder. Just type the message you want the users to get when they try to login.
  • Do not allow specific users to login : You can change the permission or owner of the home directory and the victim user will never be able to login.

The commands in this post are dangerous. You should backup all your data first.

Most of the commands will require you to be the root of the system. If you are not root then first take the permission from the root and do tell him/her your intentions

Run the commands at your risk. Author is not responsible for any harm done to the system.

Files are written in orange and commands in blue.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.