Regular users do not have permissions to alter files, however the super user can do any changes to the critical system files. For most of the times, one must avoid logging as a root user but at times one needs to login as a root user itself. Here, a small mistake could potential cause irreversible damage to the system. Take an example you are deleting a file & enter the following;
# rm -rf / etc/sysconfig/network-scripts/ifcfg-eth0:0
Noticed the space after ‘/’? That’s not intentional & it got mistyped in haste. Now, if the root user hits enter without correcting his mistake, it will lead to deletion of the entire root directory. You wouldn’t want that. However there is a simple command which prevents root user from deleting files or directories. You can set it on files or directories which you perceive to be important.
The command sets a certain attribute onto a file. These are special attributes over the regular file permissions. The attribute can be only set & unset by a root user.
# chattr +a filename
Now try doing,
# rm -rf filename
You will get,
rm: cannot remove ‘filename’ : Operation not permitted
You can do same on directories.
# chattr +a directory
This will also have an effect on the subsequent sub-directories in the specified directory. However, with the append(a) option, the file can still be altered using the append command. So to avoid that, use the immutable(i) switch instead of (a).
# chattr +i filename
The file can be now deleted nor written to(cannot be appended too).
To unset any of these attributes, simply use minus(-) along with the attribute you specified & file name/directory name.
# chattr -i filename
# chattr -a /directory/
Set this attribute on critical files & directories and you may avoid a potential doom’s day.
Screenshots are vital when reviewing an application or giving visual assistance to those problems whose solution is difficult to jot down in words. For starters, when you press the ‘Prt Scr’ i.e. ‘Print Screen’ keyboard button the computer will automatically print what is currently being displayed on the screen & prompt you to save it as a file. The Screenshot application found under GNOME provides further options to finetune screenshot capturing as per your needs. While this will work fine when you’re running under a GUI but what would you do if you want to take screenshot when you are in a shell(virtual console) or when your GUI is broken? The print screen button on your keyboard won’t work in at the command prompt. In such a case you’ll need to use the following command.
$ import -window root /home/ShutterTux/Pictures/screenshot.png
The above command will save the screenshot of the current screen without any delay into the ‘Pictures” directory of user ‘LaymanLinux’ with the file name as ‘screenshot.png’. The file saving location need not be necessarily pictures directory & you can give any location in your home directory. Do remember to change the name of the output screenshot file to avoid conflicts.
You can even issue the command with a delay;
$ delay 20; import -window root /home/ShutterTux/Pictures/screenshot2.png
The above command will take screenshot after 20 seconds and save it to the location entered by the user.
For further application of the import command, you can refer this page.
Most of the modern Linux distros can easily detect & mount external drives automatically. In extremely rare case they may fail to mount. At such times, knowing how to manually mount the external drives will come handy. This simple guide will show you to mount external drives like pendrive, external hard-disks, card reader etc in Linux.
Command Line Interface is a bonus under GNU/Linux systems. With commands you can perform virtually any task & that too in a jiffy. If you dream of administering Linux system then having a strong grip over commands will help you a long way in your endeavor. In this article, I will walk through some basic commands which will come handy. Treat these commands as your foundation of Command Line Interface under Linux. Let’s begin!
Arch Linux is a distribution for advanced linux user. The basic goal of Arch Linux is to provide users with a fast & smooth linux experience. I’ve been using Arch Linux for over a month now & I’m quite liking it. If you’re a seasoned linux user & want to try out a new distro then maybe Arch Linux is for you. Here are five reasons I feel Arch Linux rocks.