当前位置:网站首页>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 source code-RPC communication mechanism
Wireshark抓包及常用过滤方法
正则表达式小实例--验证邮箱地址
单臂路由与三成交换机
入门文档05 使用cb()指示当前任务已完成
Getting Started 11 Automatically add version numbers
Dsf5.0 bounced points determine not return a value
[Day8] (Super detailed steps) Use LVM to expand capacity
IP数据包格式(ICMP协议与ARP协议)
Hugo builds a personal blog
随机推荐
单臂路由与三成交换机
ROS video tutorial
vim的三种模式
Spark source code-task submission process-6.2-sparkContext initialization-TaskScheduler task scheduler
spark源码-RPC通信机制
LinkSLA坚持用户第一,打造可持续的运维服务方案
正则表达式小实例--去掉字符串中间和两边的空格
spark算子-coalesce算子
[Day1] (Super detailed steps) Build a soft RAID disk array
spark算子-wholeTextFiles算子
【Day1】(超详细步骤)构建软RAID磁盘阵列
LeetCode面试题
I217-V在openwrt软路由下大流量断网问题
Transport layer protocol (TCP 3-way handshake)
Three modes of vim
To TrueNAS PVE through hard disk
Hugo搭建个人博客
【Day5】软硬链接 文件存储,删除,目录管理命令
markdown编辑器模板
lvm logical volume and disk quota