240 likes | 423 Views
Introduction to Linux. Installing Linux User accounts and management Linux’s file system. Installing Linux. Follow along as we install SuSE Linux 9.1 professional. Linux Accounts. There is only 1 administrative account in Unix.
E N D
Introduction to Linux Installing Linux User accounts and management Linux’s file system
Installing Linux • Follow along as we install SuSE Linux 9.1 professional
Linux Accounts • There is only 1 administrative account in Unix. • This super-user account should not be used on a regular basis as it has unlimited access to the operating system. • Everyone else is consider a regular user account.
Each user account has a username, which is associated with a user id. • Each username and user id must be unique. • The OS, however, uses only the user id to identify the user once the user has logged in. • Therefore, you can change your username as much as you want without much trouble. (Please be aware that some other programs might be dependant on the username.)
Groups • A user may belong to one or more groups. • A group is used to further divide user accounts. (i.e. In university, there might be a math group, a scientist group, etc.) • With groups, you can grant and remove access to certain information to certain groups in the OS.
/etc/passwd • This file “/etc/passwd” stores information of all non-virtual user accounts that have direct access to the OS. • Many programs uses this file to map user accounts to user ids, therefore, this file is usually readable by anyone. • In the old days, the password for the account is also stored in there. • If someone gets a hold of that file, he can find out a user’s password. • Modern day unix systems stores the password in a separate file that’s accessible only by the root user.
In Linux and Solaris, there are two user information files: • /etc/passwd • /etc/shadow • In BSD Unix (FreeBSD, OpenBSD & NetBSD): • /etc/passwd • /etc/master.passwd • The later file is the one that contains the encrypted password of all users.
Anatomy of /etc/passwd • An entry in /etc/passwd normally contains the following fields: username:password placeholder:userid:groupid:gecos info:home directory:preferred shell • The /etc/shadow file normally contains the following fields: username:hashed password:last change:expire info • The /etc/master.passwd file for BSD Unix has the following fields: username:hashed password:userid:groupid:login class:last change:expire info:gecos info:home dir:shell
/etc/group • This file stores information about all groups. • Contains the following fields: groupname:password:users belong to the group • The group file’s password field is normally not used as this file is accessible by everyone.
BSD accounts • In BSD Unix, there are two additional versions of the password files. • /etc/pwd.db and /etc/spwd.db • They are the hashed versions of /etc/passwd and /etc/master.passwd to allow for a faster username to userid mapping. • In BSD, a user is assigned to a user class, which allows more control of the user. (i.e. how long the user can login, how much resources the user can use, etc.)
Becoming root • As said earlier, you should not be using the root account on a regular basis, so how can you become root without logging off and logging back in as root? (like in windows) • There are two commands to allow you to do things as root: su and sudo • To use it, type “su username” to becoming the other user. • su will then ask for the new user’s password. • In BSD, you have to be in the wheel group to become root. • The sudo command allows certain users to do certain tasks. (i.e. Allow user foo to install programs.) • If foo is allow to use the program bar, then foo types “sudo bar” to use the program bar. • sudo will then ask for your password, not the root password.
Unix’s Filesystem • There are many file systems for Linux: • Extend 2 • Extend 3 • Reiser • Extend 2 is the traditional linux file system, the newest one is the reiser file system. • Reiser fs provides security features like encryption. • BSD and Solaris uses the Unix File System, which is also named the Fast File System. • UFS is the original unix file system developed by BSD of course. Modern UFS also supports encryption.
In addition, there is a Network File System for network access. • NFS is a virtual file system that works with the native file system.
All unix variants should be able to write to any of the file systems each variant uses. • They can also write to the old windows DOS FAT and FAT32 file systems. • For NTFS, windows’ latest fs, all unix variants can read from NTFS. • There are experimental drivers out there that allows writing to NTFS.
File system hierarchy • The unix has a tree structure to organize its files. • The top level is the “/” directory. • Under this directory, you’ll often see: • /etc • /usr • /bin • /sbin • /home • /var • /tmp
/etc • Stores system configuration files, password information • /usr • Stores user install programs and their configuration files • /bin • Base programs that are necessary for unix to boot up. • /sbin • Like /bin, but programs that only root are supposed to have access to. • /home • Stores all user accounts • /var • Stores variable data, such as user email, a database. • /tmp • Stores temporary files.
Normal setup • Normally, the /usr, /var, /tmp and /home would be a separate partition so that quotas might be enforced. • For a home user setup, you may have /home in a separated partition and everything else in 1 partition.
Swap file • The swap file is virtual memory from the hard drive. • Windows creates this virtual memory automatically and can be adjusted through the system settings. • On unix, you have to create 1 or more swap file or unix will not function.