linux设置权限的命令

人气:226 ℃/2024-03-16 02:19:44

在linux里面使用命令设置权限有两种类别,一种是设置文件夹权限,另一种是设置用户权限,下面是具体操作:

设置文件夹权限:

1、首先要查看linux系统版本,比如cat /etc/redhat-release ,然后进入到需要查看的文件夹目录。

2、修改设置文件夹权限通常是使用chmod命令,比如“chmod 755 文件\目录名”。

设置用户权限:

1、添加用户

首先要用adduser命令添加一个普通用户,命令如下:

#adduser tommy //添加一个名为tommy的用户

#passwd tommy //修改密码

Changing password for user tommy.

New UNIX password: //在这输入新密码

Retype new UNIX password: //再次输入新密码

passwd: all authentication tokens updated successfully.

2、赋予root权限

修改 /etc/sudoers 文件,找到下面一行,将前面的注释符号(#)去掉

## Allows people in group wheel to run all commands

%wheel ALL=(ALL) ALL

接着修改用户,让其能够属于root组(wheel),具体命令是:

#usermod -g root tommy

修改完毕之后就能够使用tommy帐号登录,接着用命令su -,就可以获得root权限进行其他操作了。

<上一篇下一篇>

推荐

首页/电脑版/地图
© 2024 JiaChangBa.com All Rights Reserved.