Permissions
The Unix operating system (and likewise, Linux) differs from other computing environments in that it is not only a multitasking system but it is also a multi-user system as well. What exactly does this mean? It means that more than one user can be operating the computer at the same time. While your computer will only have one keyboard and monitor, it can still be used by more than one user. For example, if your computer is attached to a network, or the Internet, remote users can log in via telnet or ssh (secure shell) and operate the computer. In fact, remote users can execute X applications and have the graphical output displayed on a remote computer. The X Windows system supports this. The multi-user capability of Unix is not a recent "innovation," but rather a feature that is deeply ingrained into the design of the operating system. If you remember the environment in which Unix was created, this makes perfect sense. Years ago before computers were "personal," they were large, expensive, and centralized. A typical university computer system consisted of a large mainframe computer located in some building on campus and terminals were located throughout the campus, each connected to the large central computer. The computer would support many users at the same time. In order to make this practical, a method had to be devised to protect the users from each other. After all, you could not allow the actions of one user to crash the computer, nor could you allow one user to interfere with the files belonging to another user. This lesson will cover the following commands:
File permissions: run: ls -lh It shows: total 16 drwxr-xr-x 2 shaowu shaowu 4096 Sep 15 09:43 Ex1 drwxr-xr-x 2 shaowu shaowu 4096 Sep 15 14:52 Ex2 drwxr-xr-x 2 shaowu shaowu 4096 Sep 15 14:52 Ex3 -rw-rw-r-- 1 shaowu shaowu 12 Sep 17 18:35 lab2.sh let's look at the last row -rw-rw-r-- First rw is about the user:shaowu in group shaowu: r means it is you can read; w means you can write as well; Second xr means the group that owns this file is shaowu, its user can: -read and write Third r means: the people of anyone else can read only However, as you can see user shaowu don't have the right to execute the .sh file. so run the following command: chmod u+x lab2.sh it let the user(u) to be enable for the execution ability. So in general, you can use chmod ?+? the first ? is u: user g: group o: others a: all the second ? is r: read w: write x: execute C++
1. cout formatted output Purpose: to set precision of numerical number std::cout << std::fixed << std::setprecision(2) << d << std::endl; |
AuthorShaowu Pan Archives
December 2017
Categories
All
|