CHAPTER 14 UNDERSTANDING LINUX (Web site hosting) FILES AND USERS
CHAPTER 14 UNDERSTANDING LINUX FILES AND USERS total 112 drwxr-xr-x 2 root root 4096 2005-10-14 22:29 bin drwxr-xr-x 3 root root 4096 2005-10-14 18:25 boot lrwxrwxrwx 1 root root 11 2005-10-14 18:01 cdrom -> media/cdrom drwxr-xr-x 2 root root 4096 2005-10-14 18:09 debootstrap drwxr-xr-x 12 root root 0 2005-10-16 12:25 dev drwxr-xr-x 100 root root 4096 2005-10-16 12:25 etc drwxr-xr-x 3 root root 4096 2005-10-14 18:20 home drwxr-xr-x 2 root root 4096 2005-10-14 18:02 initrd lrwxrwxrwx 1 root root 28 2005-10-14 18:08 initrd.img -> boot/initrd.im g-2.6.12-9-386 drwxr-xr-x 19 root root 4096 2005-10-14 22:30 lib drwxr-xr-x 2 root root 49152 2005-10-14 18:00 lost+found drwxr-xr-x 5 root root 4096 2005-10-14 18:01 media drwxr-xr-x 2 root root 4096 2005-10-05 05:37 mnt drwxr-xr-x 2 root root 4096 2005-10-14 18:02 opt dr-xr-xr-x 115 root root 0 2005-10-16 08:24 proc drwxr-xr-x 8 root root 4096 2005-10-16 03:47 root drwxr-xr-x 2 root root 4096 2005-10-14 22:29 sbin drwxr-xr-x 2 root root 4096 2005-10-14 18:02 srv drwxr-xr-x 10 root root 0 2005-10-16 08:24 sys drwxrwxrwt 9 root root 4096 2005-10-16 17:27 tmp drwxr-xr-x 13 root root 4096 2005-10-14 22:29 usr drwxr-xr-x 14 root root 4096 2005-10-14 22:47 var lrwxrwxrwx 1 root root 25 2005-10-14 18:08 vmlinuz -> boot/vmlinuz-2.6. 12-9-386 The first thing you ll notice from this is that the root of the file system contains largely directories and that all files and directories are owned by root. Only users with administrative powers can write files to the root of the file system. That means if you wanted to write to the root of the file system or otherwise access those files, you would need to use the sudo command. This is to prevent damage, since most of the directories in the root of the file system are vital to the correct running of Linux and contain essential programs or data. Caution It s incredibly easy to slip up when using the command-line shell and thereby cause a lot of damage. For example, simply mistyping a forward slash in a command can mean the difference between deleting the files in a directory and deleting the directory itself. This is just another reason why you should always be careful when working at the command line, especially if you use the sudo command. As you can see from the file permissions of each directory in the root of the file system, most directories allow all users to browse them and access the files within (the last three characters of the permissions read r-x). You just won t be able to create new files there or delete the