当前位置:网站首页>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
边栏推荐
- 【Machine Learning】1 Univariate Linear Regression
- Apache配置反向代理
- 线上问题排查流程
- The problem of redirecting to the home page when visiting a new page in dsf5.0
- spark源码-任务提交流程之-2-YarnClusterApplication
- Spark源码-任务提交流程之-6.2-sparkContext初始化-TaskScheduler任务调度器
- ROS video tutorial
- 入门文档11 自动添加版本号
- spark源码-任务提交流程之-4-container中启动executor
- ROS视频教程
猜你喜欢
随机推荐
spark算子-parallelize算子
Getting Started 03 Distinguish between development and production environments ("hot update" is performed only in the production environment)
Getting Started Document 07 Staged Output
时间复杂度和空间复杂度
添加新硬盘为什么扫描不上?如何解决?
Wireshark抓包及常用过滤方法
ROS视频教程
【Day8】Knowledge about disk and disk partition
ACLs and NATs
网络布线与数制转换
硬盘分区和永久挂载
7步完成云上监控
Wechat applet page jump to pass parameters
Transport layer protocol (TCP 3-way handshake)
【Day5】软硬链接 文件存储,删除,目录管理命令
ROS video tutorial
spark算子-repartition算子
【Day8】磁盘及磁盘的分区有关知识
Autoware--北科天绘rfans激光雷达使用相机&激光雷达联合标定文件验证点云图像融合效果
I/O性能与可靠性