Linux novice asks: What is the directory that ordinary users can modify?

Updated on technology 2024-02-09
8 answers
  1. Anonymous users2024-02-05

    1. By default, ordinary users can only modify their own user directories. A group represents a set of permissions, which have nothing to do with a directory, and this permission can be access to a directory or an operation (such as sudo).

    2. You first need to understand the linux directory permissions, which will appear when you use ls -l to view and touch a directory.

    d|rwx|r-x|r-x 2 username groupname (|Separation is my plus convenient explanation) d represents the directory, if it is a file then it will be a minus sign, the second part represents the permission of the owner of the secondary file or directory, here is read and write executable, the third part means that the secondary file or directory has the permission of "group", there is no write permission here, the fourth part is the permission of other users, down is a number, this is the file system number, don't care, followed by the user and group to which the file belongs.

    For example, the usr local directory still has no write permission on the group, and it is useless for you to join the root group. You're better off using sudo to do it.

  2. Anonymous users2024-02-04

    How does Linux modify the users and groups to which a file belongs?

    In Linux, when you create a file, the owner of the file is the user who created it. The user of the file can modify the owner and user group of the file; Or under the root user, you can modify the owner and user group of any file.

    To modify the users and groups to which a file belongs, you need to use the chown command.

    chown command, it can be considered to be"change owner", which is mainly used to modify the owner of a file (or directory), but also to modify the group to which a file (or directory) belongs.

    When you only need to modify the owner, you can use the basic format of the chown command as follows:

    The r (note capitalization) option means that the owner is changed, along with all the files in the subdirectory.

    When you only need to modify the group you belong to, you can use the basic format of the chown command as follows:

    If you need to change both the owner and the group you belong to, the basic format of the chown command is:

    Note that in the chown command, the dot (.) can also be used between the owner and the group to which they belongHowever, there is a problem with the fact that if the user adds a decimal point to the setting (e.g., , it will cause the system to misjudge. Therefore, it is recommended that you use a colon to connect the owner and the group to which you belong.

    Of course, the chown command also supports simply modifying the group to which a file or directory belongs, for example, chown :group indicates the group to which the file belongs is modified, but the chgrp command is usually used to modify the group, so it is not recommended to use the chown command.

    Another thing to note is that when you use the chown command to modify the owner (or owner) of a file or directory, you must ensure that the user user (or user group) exists, otherwise the command will not be executed correctly, and a prompt will be displayed"invalid user"or"invaild group"。

    Example of using the chown command

    1. Change the owner of the file.

    First, let's use the ls -l command to see where the file belongs, e.g. .

    Let's use the chown command to change the owner of the tmpfile file.

    Then use the ls -l command to check where the tmpfile file belongs.

    It can be seen that the owner of the tmpfile file has changed from "himanshu" to "root".

    2. Change the filegroup.

    You can also change the group (the group to which the file belongs) with the chown command.

    Use the following command to change the group to which a file belongs:

    Then use the ls -l command to check where the tmpfile file belongs.

    You can also change the owner and group of a file to root at once by using the following command:

  3. Anonymous users2024-02-03

    ID to view the user ID.

    To modify the user's default directory, it is not the instruction you gave, but the following:

    usermod -d "New Directory" "Username".

  4. Anonymous users2024-02-02

    To view the user ID, you can directly use the ID command in Linux.

  5. Anonymous users2024-02-01

    Your question is a test of comprehension, and it is not okay to typeset well??!

  6. Anonymous users2024-01-31

    You don't need to know the user ID.

    usermod -d usr web1 username.

    The option is to modify the user ID, not your current user ID

  7. Anonymous users2024-01-30

    You can use the cd command to switch the current directory to the specified folder. CD is an abbreviation for Change Directory.

    Command format: cd [directory name].

    Example: Switch the current directory to the var log directory $ cd var log

    You can run the pwd command to view the current directory before and after you switch directories to indicate changes in the current directory.

  8. Anonymous users2024-01-29

    Do you need to change the directory name, change the directory permissions, or just switch the directory path to change the directory name:

    cd ..mv a b

    Change directory permissions.

    cd ..chmod 777 a

    Toggle directories. cd ..or cd / or cd ../..Wait.

Related questions
12 answers2024-02-09

The only way to do that is to try to log in with a single user to see if root can be recovered. >>>More

15 answers2024-02-09

It depends on what version it is! 4gs?It looks like it's an iPhone 4 that just been released, right? >>>More

3 answers2024-02-09

If the foundation is good, you can read the book directly and follow the operation. >>>More

26 answers2024-02-09

I don't know much about that.

4 answers2024-02-09

tar jxvf and then enter the directory that has just been extracted, and execute the following command. >>>More