[英]Linux command on changing ownership and displaying files
Hi I am new to Linux and I need to learn how to perform these 3 tasks嗨,我是 Linux 的新手,我需要学习如何执行这 3 个任务
-rw-r--r--@ 1 user1 staff 108 Oct 17 21:28 coolstuff.o
root
superuser and you are not user user1
.假设您没有以root
超级用户身份登录,并且您不是用户user1
。user1
to user2
.将所有权从user1
更改为user2
。 Assume you are not logged in as the root
superuser and you are not user1
or user2
.假设您没有以root
超级用户身份登录,并且您不是user1
或user2
。.o
files (and no other files) in this directory (assuming you are currently in the directory), making sure that the permission information for them is shown (as in the example above).列出此目录中的所有.o
文件(没有其他文件)(假设您当前在该目录中),确保显示它们的权限信息(如上例所示)。 This is useful when making sure that the file permission and ownership changes occurred as expected and that other files are unchanged.这在确保文件权限和所有权更改按预期发生并且其他文件未更改时很有用。To change directory permissions in Linux, use the following:要更改 Linux 中的目录权限,请使用以下命令:
chmod +rwx filename to add permissions.
chmod -rwx directoryname to remove permissions.
chmod +x filename to allow executable permissions.
chmod -wx filename to take out write and executable permissions
The command for changing directory permissions for group owners is similar, but add a “g” for group or “o” for users:更改组所有者的目录权限的命令类似,但为组添加“g”或为用户添加“o”:
chmod g+w filename
chmod g-wx filename
chmod o+w filename
chmod o-rwx foldername
for changing permission from user1 to user2用于将权限从 user1 更改为 user2
chown name filename
for only.o file with permissions仅适用于具有权限的.o 文件
ls -l *.o
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.