The Linux programming Interface
Users and Groups
(01) Users and Groups
Every user has a unique login name and an associated numeric user identifier (UID). Users can belong to one or more groups. Each group also has a unique name and a group identifier (GID).
(/etc/passwd) Documents
With the user name, login ID, and other information.
(03) Password file/etc/shadow
CAT/ETC/PASSWD//View all user informationCAT/ETC/PASSWD|GREP User name//view information for a particular userCat/etc/group//View all group informationCAT/ETC/GROUP|GREP Group name//view information for a group nameGroups//view members of the currently logged in user groupGroups test//View the group that the test user is in, and the members in the groupWHOAMI//view current login user nameFind a group for newly added usersgroupadd developersThen create the user MX and add it to the developers use
Typically, as a deployment script for an application, the first task that begins is to create a dedicated (dedicated) user and user group for the current app. This script is very simple, a reference sample is attached here:[Plain]View Plaincopy
#!/bin/sh
User=test_user
Group=test_group
#create group if not exists
Egrep "^ $group"/etc/group >/dev/null
If [$?-ne 0]
Then
Groupadd $group
Fi
#create user if not exists
Egrep "^ $user"/etc/pass
Typically, as a deployment script for an application, the first task that starts is to create a dedicated (dedicated) user and user group for the current app. This script is very easy. Here is a sample of references:#!/bin/shuser=test_usergroup=test_group#create group if not existsegrep "^ $group"/etc/group >/dev/nullif [$?- NE 0]then groupadd $groupfi #create user if not existsegrep "^ $user"/etc/passwd >/dev/nullif [$?-ne 0]the n useradd-g $group $userfiFor the user to join, we can also
Describe:
Write a function, pass in an int array, returns whether the array can be divided into two groups, so that the elements of the two groups are combined and equal, and that all multiples of 5 must be in one group, all multiples of 3 in another group (excluding a multiple of 5), which satisfies the above conditions and returns true , false when not satisfied.
Knowledge Points:
Lang
| 10;20;20 | | 2 | 20| | 3 | 200;500 |+------+----------------------------------+3 rows in Set (0.00 sec) is grouped by ID, printing the value of the de-redundant name field on one line, separated by commas mysql> Select Id,group_concat (Distinct NAMe) from the AA group by id;+------+-----------------------------+| id| Group_concat (distinct name) |+------+-----------------------------+|1 | 10,20| | 2 | 20 | | 3 | 200,500 |+------+-----------------------------+3 rows in Set (0.00 sec) is groupe
to complete the corresponding task, but sudo can directly follow the command, such as Sudo Root can be executed without root password only root can execute the corresponding command, but it has to be visudo to edit the/etc/sudoers to achieve;Visudo Note: Visodo is the editor of the/etc/sudoers command, you can not use this command, directly with VI to edit the/etc/sudoers effect is the same;Sudoedit Note: Similar to the sudo function;
3, the management of user
such as Telnet, and the other is the port on the target machine where the Getty program is connected (for example, TTYP2). The Telnet program on the login machine and the login program on the target machine are communicated through the pseudo terminal ptyp2 and TTYP2.
The control terminal (/dev/tty) is a concept in the application. Each session group may have up to 1 control terminals, similar to Tty0, and performing the console interrupts currently in use. For this concept, it is recommended t
Add/delete Linux users and groups and delete user groups in linux
1. User Creation:Adduser phpq // create a phpq userPasswd phpq // set a password for the phpq user
2. Create a working groupGroupadd test // create a test workgroup
3. Create a user and add a Working GroupUseradd-g test phpq // create a phpq user and add it to the test workgroup
Note: SHELL used by-g's group-d home directory-s
4. Add a workin
Title: The number in the array is divided into two groups, giving an algorithm that makes two groups of the sum of the absolute value of the smallest array of values is 0For example a[]={2,4,5,6,7}, the resulting two groups of {2,4,,6} and {5,7},abs (sum (A1)-sum (a2)) = 0;For example {2,5,6,10},abs (sum (2,10)-sum (5,6)) = 1, so the two sets of numbers are {2,10
When I recently made a project with a DataTable in jquery, I encountered a problem that required generating groups of radio buttons, and the name of each radio button group was different, and of course I thought of using loops to generate the radio button groups. There is no problem with generating the radio button group itself, but when the list interface is refreshed again, the index of the generated radi
Win10 does not provide solutions for local policy groups, local users, and groups.
Windows 10 has become popular. Many users find that the system lacks some features, such as the inability to add local users, the absence of local users and groups, and the absence of local policies. This is not a computer reason, but a win10 system version. To solve these problem
1. User lock: Passwd-l user12. Unlock User: Passwd-u user13. User no Password registration: passwd-d user14. Add to the secondary user group: Gpasswd-a user1 boss (group name)Remove user to Secondary user group: Gpasswd-d user1 boss5. Switch to the Boss user group: Newgrp boss (after User1 login), you may want to enter a user group.6. Add users to the main user group and to the secondary user group:Useradd-g group01-g GROUP02,GROUP037. Group user group plus password: gpasswd newpasswd renewpassw
Add users to user groups and user groups in Linux
Http://blog.csdn.net/pursue168/article/details/6443046
To add a user to a user group, do not directly use: usermod-G groupAThis will cause you to leave other user groups and act only as a member of the groupA user group. -A option should be added: usermod-a-G groupA user
(FC4: usermod-G groupA, groupB, groupC user
Comparison of two groups of signals in Linux and two groups of signals in Linux
Blog gradually migrated to, independent blog, original address http://www.woniubi.cn/two_groups_signal_difference/
When looking at the signal, I did not pay too much attention to the comparison of different signals. when I saw it again today, I suddenly felt that some signals were very similar and even very confusing. I will tak
1. Add a user groupTo add a user group using the Groupadd command:Groupadd group_nameThis operation needs to be done by the system administrator.2. Delete a user groupTo delete a user group using the Groupdel command:Groupdel group_nameThis operation needs to be done by the system administrator.3. Define Group AdminsUse the GPASSWD command to specify the group administrator:Gpasswd-a User Group_nameThis operation needs to be done by the system administrator.4. Set the group passwordTo set the gr
We sometimes create an extra user to use for others to protect our own user security and privacy, while the new Windows default standard user can basically meet this control, but the user is not authorized to modify the IP property if the change of the working environment is required. This has affected users in a range of users, Microsoft has made a separate user group to modify IP properties, simply through the Control Panel-> management tools-> Computer Management-> Local Users and
Users and groups of linux commands, linux Command groups
1. Files for saving user information
root:x:0:0:root:/root:/bin/bashpwftp:x:500:500::/alidata/www/wwwroot/:/sbin/nologinapache:x:48:48:Apache:/var/www:/sbin/nologinmysql:x:501:400::/home/mysql:/sbin/nologin
A total of 7 items are separated:
1
User Name
2
Password
The real password is saved in/etc/shadow.
Create multiple user groups and users, set up candidate groups, default shellgroupadd-g 40000 adminuser specify GIDUseradd natasha-g adminuser Specify a subordinate group[Email protected]/]# Useradd Harry-gadminuser[Email protected]/]# Useradd sarah-s/bin/nologin[Email protected]/]# echo "Glegunge" | passwd--stdin Natasha Specify passwordChanging password for user Natasha.Passwd:all Authentication tokens up
#define NSLOG (FORMAT, ...) fprintf (stderr, "%s\n", [[NSString Stringwithformat:format, # #__VA_ARGS__] utf8string]);#import int main (int argc, const char * argv[]) {@autoreleasepool {Variable groups inherit immutable groups1, create. Set the number of elements to createNsmutablearray *arr=[nsmutablearray Arraywithcapacity:7];2. Add an element to the arrayNsarray *[email protected][@ "Mon", @ "Tue", @ "Wed", @ "Thu", @ "Fri", @ "sat", @ "Sun"];//imm
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.