amazon.com

ad brite ads

Your Ad Here

Hi visitor!

These are mostly serious stuff. Reviews. Comments. Analysis. And lots of thoughts on stuff. I would love to read your comments. Happy reading!

Monday, August 11, 2008

Linux how NOT to: chmod mistakes

I am no Linux expert. I initially learned from an IT school and worked my way through experience.

Last night, I tried to tinker with my PC running on Bayanihan Linux 4 developed by the Advanced Science and Technology Institute of the Department of Science and Technology of the Republic of the Philippines.

In my home directory, I have three folders kenni, lyn, and shared. The kenni folder is of course owned by me. The lyn folder is owned by my wife. And the shared folder I had for so long wanted to be shared by the both of us.

In Windows, when your drive is formated in FAT32 rather than NTFS, each and every user with an account in the PC can access the folders of other users with accounts in that same PC. This is eliminated by formating your drives in NTFS.

In Linux, drives are formated in ext3 (at least for this one I use since I don't really know if other distributions of Linux also use ext3). Each individual user of a Linux-powered PC with an account cannot access anybody else's folder. Unless of course you are the root administrator.

Back to my story, I was trying to make the shared directory accessible to me and my wife so I opened the Linux command list I compiled over the years. And here is what I typed on the terminal console:

$chmod 644 . shared

I was trying to make shared accessible to everyone. 6 means that the owner of the file or folder can read and write on the file but cannot execute. The first 4 means that the group where the user belongs to or one indicated can read the file but cannot write on and/or execute the file. The last 4 means the everyone else can read the file but cannot write on and/or execute the file.

NOTE: To be able to use chmod without restriction, one must first log in as the root user.

When I typed the above in, my shared folder disappeared from the Konqueror explores window (similar to the Windows Installer). I was shocked and did not know what to do.

I tried to reverse what I did (I thought I could) with this command:

$ chmod 644 shared .

This time the folders inside my home directory disappeared. Now I am terrified. All those files, GONE!

But when I had the directory listed while logged on as root (I did not close the terminal console to be sure) by typing:

$ ls

I saw that the folders were still there.

To remedy this, I typed in:

$ chmod 700 /home/kenni

To allow the owner of the folder kenni to read, write, and execute anything on the folder kenni. I had to list the whole directory path since putting in kenni instead of /home/kenni makes the software search for a file named kenni. I did the same to the folder lyn owned by my wife and to the folder shared owned by myself with read access only to my wife.

This put everything back to normal. And allowed me to sleep soundly that night. :)

No comments: