Author: Ruwantha Nissanka

What are inodes in linux?

An inode is a data structure that contains metadata about a file. When the file system stores a new file on the hard disk, it stores not only the contents (data) of the file, but also extra properties like the name of the file, the creation date, its permissions, the owner of the file, and more. All this information (except the name of the file and the contents of the file) is stored in the inode of the file. The ls -l command will display some of the inode contents, as seen in this screenshot #ls -ld <directory_name> The inode table contains all of the inodes and is created when you create the file system (with mkfs). You can use the df -i command to see how many inodes are used and free on mounted file systems. #df -i In the df -i screenshot above you can see the inode usage for several mounted file systems. You don’t see numbers for /dev/sda2 because it is a fat file system. inode number Inode number is also known as index number. It is a unique number assigned to files and directories while it is created. The inode number will be unique to entire filesystem. You can see the inode numbers with the ls -li command. #ls -li These three files were created one after the other and got three different inodes...

Read More

A guide to Setting advanced file permissions in linux

In our previous post, we have discussed about how to set the standard file permissions in our linux system. In this guide we will see how to set more advanced permissions to our files. sticky bit on directory You can set the sticky bit on a directory to prevent users from removing files that they do not own as a user owner. The sticky bit is displayed at the same location as the x permission for others. The sticky bit is represented by a t (meaning x is also there) or a T (when there is no x for others). The sticky bit can also be set with octal permissions, it is binary 1 in the first of four triplets. You will typically find the sticky bit on the /tmp directory. setgid bit on directory setgid can be used on directories to make sure that all files inside the directory are owned by the group owner of the directory. The setgid bit is displayed at the same location as the x permission for group owner. The setgid bit is represented by an s (meaning x is also there) or a S (when there is no x for the group owner). As this example shows, even though root does not belong to the group proj55, the files created by root in /project55 will belong to proj55 since the setgid is...

Read More

How to set standard file permissions in linux

Linux operating system allows multiple users to work on the same system simultaneously without disrupting each other. Because of this feature, Individuals sharing access to files pose a risk exposing classified information or even data loss if other users access their files or directories. To address this, we can specify how much power each user has over a given file or directory by setting file permissions. rwx The nine characters following the file type denote the permissions in three triplets. A permission can be r for read access, w for write access, and x for execute. You need the r permission to list (ls) the contents of a directory. You need the x permission to enter (cd) a directory. You need the w permission to create files in or remove files from a directory We already know that the output of ls -l starts with ten characters for each file. This screenshot shows a regular file (because the first character is a – ). permission examples Some example combinations on files and directories are seen in this screenshot. The name of the file explains the permissions. To summarise, the first rwx triplet represents the permissions for the user owner. The second triplet corresponds to the group owner; it specifies permissions for all members of that group. The third triplet defines permissions for all other users that are not the...

Read More

Over 16,000 readers, Get fresh content from “The Linux juggernaut”

Email Subscribe

ABOUT ME..!

My photo
My name is Surendra Kumar Anne. I hail from Vijayawada which is cultural capital of south Indian state of Andhra Pradesh. I am a Linux evangelist who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. At present I work at Bank of America as Sr. Analyst Systems and Administration. You can contact me at surendra (@) linuxnix dot com.