当前位置:网站首页>User and user group management, file permission management
User and user group management, file permission management
2022-08-05 06:15:00 【sologuai】
1. Manage user accounts
- Categories
Super user: The root user is the default super user account in the Linux operating system, and has the highest authority to the host. The super user is the only one in the system.
Ordinary user: Created by the root user or other administrator users, the permissions they have will be limited. Generally, they only have full permissions in the user's own home directory.
Program users: When installing the Linux operating system and some applications, some specific low-privilege user accounts will be added. These users are generally not allowed to log in to the system, and are only used to maintain the normal operation of the system or a program, such asbin, daemon, ftp, mail, etc.
2.uid logo
- The UID of the root user account has a fixed value of 0
- The default UID of the program user account is Centos5,6: 1~499, Centos7: 1~999
- The default UID for common users is Centos5, 6: 500~ 65535, Centos7: 1000~ 60000
Second, add user account useradd
useradd [options] username
-u specifies the user's UID
[[email protected] ~]# useradd -u 2000 helen //Add the helen user and specify the UID as 2000[[email protected] ~]# tail -1 /etc/passwd //View the information of helen in passwdhelen:x:2000:2000::/home/helen:/bin/bash
-s specifies the user's login shell (usually for program users)
[[email protected] ~]# useradd -s /sbin/nologin apache //Create a user and specify the login shell as /sbin/nologin, the user cannot log in to the system[[email protected] ~]# tail -1 /etc/passwdapache:x:2008:2008::/home/apache:/sbin/nologin
Three, set/change the user password passwd
passwd [username]
Set or modify user password
[[email protected] ~]# passwd nancy //Set or modify the password of the nancy userChange the password for user nancy.new password:Re-enter new password:passwd: All authentication tokens have been successfully updated.[[email protected] ~]# echo "linux666" | passwd --stdin nancy //Easy to set user passwordChange the password for user nancy.passwd: All authentication tokens have been successfully updated.
Fourth, modify the attribute usermod of the user account
usermod [options]... username
[[email protected] ~]# usermod -l sasha helen //Change the username of helen to sasha[[email protected] ~]# usermod -L sasha //Lock user sasha[[email protected] ~]# passwd -S sasha //View sasha status, it has been lockedsasha LK 2022-02-21 0 99999 7 -1 (Password is locked.)[[email protected] ~]# usermod -U sasha //Unlock user sasha[[email protected] ~]# passwd -S sasha //View sasha status, normal status
Five, set the attribution of files and directories chown
chown owner file or directory //modify owner
chown:group file or directory //modify group
chown owner:group file or directory //modify owner and group
-R: recursively modify the ownership of all files and subdirectories in the specified directory
Six, file and directory permissions management chmod
The read, write, and execute permissions of the file can be represented by the characters r, w, x, or as the octal numbers 4, 2, and 1, respectively
边栏推荐
猜你喜欢
随机推荐
Spark源码-任务提交流程之-6.2-sparkContext初始化-TaskScheduler任务调度器
【Day8】(超详细步骤)使用LVM扩容
spark源码-RPC通信机制
单臂路由与三成交换机
Three modes of vim
Spark source code-task submission process-6.2-sparkContext initialization-TaskScheduler task scheduler
入职前,没想到他们玩的这么花
线上问题排查流程
VLAN details and experiments
运维工程师,快来薅羊毛
Introductory document 05-2 use return instructions the current task has been completed
The spark operator - repartition operator
入门文档12 webserve + 热更新
OpenCV3.0 is compatible with VS2010 and VS2013
TCP/IP四层模型
【Day1】VMware软件安装
【Day8】Knowledge about disk and disk partition
I217-V在openwrt软路由下大流量断网问题
Spark source code - task submission process - 4-container to start executor
dsf5.0新建页面访问时重定向到首页的问题