|
Personal tools |
|
|
/User Guide/Concepts
From AnnvixBasic Concepts To get the most out of Annvix, or any UNIX-like operating system, one has to understand some basic UNIX concepts. These concepts include things like users and groups, the basic commandline, some basic tools, and so forth.
TopicsOther related topics:
Users and GroupsBecause Linux is a multi-user system, the average Linux system has more than one user, even if there is only one human using it. The reason being that a number of tasks and services are run by other users, and don't forget the root account (aka super-user). An account on a Linux system typically involves three things: The user's real name, the user's login name, and the user's password. Obviously there is more (such as what shell they use, their home directory, etc.) but the basic "requirements" of a human-using account are these three things. The user's real name is obvious. The user's login name is the name that is used to log into the system and is usually an abbreviation of their real name. For instance, the user "Chum Shark" might have a login name of "chum" or "cshark". The password is the authentication token used to prove that "chum" is indeed Chum Shark and is required to login. Each user also belongs to a group. Annvix does not impose any limitations or qualifications for groups. By default, two special groups exist: "users" and "admin". The admin group is a special group that only administrators of the system should belong to. The users group is an optional group that all users can belong to. As well, each user should have their own group with the same name as their login name. For instance, user chum should belong to the group "chum" and could also belong to group "users" (since he is a user). If Chum Shark is an administrator of this machine, he should also belong to group "admin" which will grant him special privileges on the system via sudo. Also note that users can belong to as many, or as little, groups as you like. You could have other groups (perhaps "staff" or "isteam", etc.) that a user may or may not belong to, being entirely to your discretion. Group information is stored in flat files on the system. Group information is stored in the /etc/groups file; user information is stored in /etc/passwd and user passwords are stored in encrypted format in /etc/shadow. Any user can read the groups and passwd file; only root should have access to the shadow file. Creating users and groups is described in Installing Annvix: Creating a User. To log into an Annvix system, you need physical access to login at a terminal, or remote access to login via ssh. At a physical machine, you can get to other virtual terminals by pressing ALT+F1 through ALT+F6; each is it's own virtual terminal (so you can be logged in multiple times via multiple terminals). Files and PermissionsUnderstanding user and group concepts is essential to understanding how file permissions work. Files are handled differently under Linux than they are under Windows. In Linux, every file has certain permissions and ownership associated with them. Just because a file exists, does not mean that anyone can write to it, or even read it. Each file has three basic permissions: read permission, write permission, and execute permission (symbolized by the letters r, w, and x respectively). As well, each file is also broken down into ownership: user, group, and other. Because of this, permissions can be fine-tuned on a per-file basis. A file owned by a user may have read and write permissions, the same file owned by a different group (say "users") may have group read permissions (but not write permission), and may have no permissions for others (those that are neither the owner nor in the group-owned group). To illustrate this, look at the following: [chum@pond ~]$ ls -l /var/log/wtmp -rw-rw-r-- 1 root utmp 11136 Apr 17 22:59 /var/log/wtmp Here, the file /var/log/wtmp is owned by user root and group utmp. The permissions here are:
This means that user chum, who is neither root nor a member of group utmp, can only read the file; he cannot write to it. To determine your group membership, use the id command: [vdanen@build ~]$ id uid=1001(chum) gid=1001(chum) groups=1001(chum),11(admin),92(svn) Here you can see that chum is a member of group chum, group admin, and group svn. Nowhere is he a part of group utmp. The permission representation of a file is represented by nine characters that break down into groups of three; the first three for the user, the second three for the group, and the last three for others, so that, for instance: rwxr-xr-x represents:
If a permission bit is not set, it will show as a "-". Take this example: rw------- This represents:
File ownership and directory ownership differ slightly; the execute bit (x) on a file means that a user can run the file, either automatically via a shell or program (such as as bash script or perl script) or because it is a compiled executable program. The execute bit on a directory, however, means that the user has access to the directory; they can cd into the directory (also called traversing). For read permissions, on a file the file may be access to be read; on a directory the contents of the directory may be viewed. For write permissions, on a file it may be written to and deleted; on a directory, the contents of the directory can be manipulated (files can be added and deleted). ProcessesA process is an instance of a program being executed. Each process is executed with the rights of the user that executed the program. Each process has a unique process ID (or PID). This PID is used to let the system know various information about a process, including the user that started it, the environment the process is using, commandline arguments, and so forth. Process information can be viewed via the /proc filesystem for detailed information and via programs such as ps and top. Processes can be terminated with the kill command. The Command LineUnlike other Linux distributions where a user may never use the command line, Annvix requires you to have some familiarity and competence with the command line. Annvix does not provide a pretty GUI interface with graphical programs to handle day-to-day system use or administration. In fact, if you can't use a command line, you can't use Annvix. The command line is the shell; by default the bash shell, although other shells are available (such as tcsh, zsh, and even sash). The command line is what is used to navigate the system, execute programs and commands, and so forth. Using Annvix, you will become very familiar with the command line and realize how much more flexible and powerful it is than using a GUI program. Using the command line is also called using the shell, or using a console. The basic command prompt typically looks like: [chum@pond ~]$ Command prompts can be customized to look different, but this is the default. For the root user, the "$" symbol will become a "#" symbol: [root@pond ~]# When you first log into the system, you will be placed into your home directory, typically /home/user. You can determine your location in the filesystem at any time by using the pwd command: [chum@pond ~]$ pwd /home/chum [chum@pond ~]$ ExamplesHere are some basic commands that are useful day-to-day. To navigate around the system use the cd command: [chum@pond ~]$ cd /etc [chum@pind /etc]$ To view the contents of a file, use cat; it will display the contents of the file to the screen. For longer files, you can pipe cat through the less program, or use less on it's own (ie. less /etc/passwd). To see the contents of a directory use ls: [root@pond ~]# ls /var/log/system/auth @40000000440de2d91137d834.u @40000000440de31f0bda6e74.u @40000000440de3472ed5400c.u config current lock To get more details of the files, such as ownership, permissions, and so forth, use some arguments with ls: [root@build ~]# ls -al /var/log/system/auth total 84 drwxrwx--- 2 root syslogd 146 Mar 7 12:47 ./ drwxr-x--- 18 root syslogd 4096 Mar 7 12:41 ../ -rw-r--r-- 1 syslogd syslogd 169 Mar 7 12:43 @40000000440de2d91137d834.u -rw-r--r-- 1 syslogd syslogd 221 Mar 7 12:45 @40000000440de31f0bda6e74.u -rw-r--r-- 1 syslogd syslogd 350 Mar 7 12:47 @40000000440de3472ed5400c.u -rw-r----- 1 root syslogd 23 Sep 18 2005 config -rw-r--r-- 1 syslogd syslogd 21158 Apr 18 12:30 current -rw------- 1 syslogd syslogd 0 Mar 7 12:42 lock The "-al" options tells ls to display all files (a) in format that displays additional information (l). You can use wildcards as well, such as ls -l /etc/*.conf. ReferencesHere are some links with some additional information useful for beginners or those unfamiliar with the command line and some basic concepts required to really get the most out of Annvix. |
![]() |
|
|
| |||