Меню Рубрики

Folder owner linux change

changing the owner of folder in linux [closed]

Want to improve this question? Update the question so it’s on-topic for Stack Overflow.

Closed 6 years ago .

I have a folder in my subdomain which is created through WHM so the owner of that subdomain is not the owner of main domain.

I want to change the owner of one of the folders of subdomain to domain owner. I tried this, but when I check with winscp it shows owner as 500.

I’ve tried to change from winscp also, but there is no option for winscp, so I’ve logged in as root using putty and ran the command from above, but it doesn’t help and I am unable to upload any file to subdomain from the main domain, as it returns error «permission denied».

I want to give the ownership of rohan to sujit to have rights to upload file from sujit domain to subdomain rohan

Update:

Now it is changing owner to 500

1 Answer 1

Use chown to change ownership and chmod to change rights.

use the -R option to apply the rights for all files inside of a directory too.

Note that both these commands just work for directories too. The -R option makes them also change the permissions for all files and directories inside of the directory.

will change ownership (both user and group) of all files and directories inside of directory and directory itself.

will only change the permission of the folder directory but will leave the files and folders inside the directory alone.

you need to use sudo to change the ownership from root to yourself.

Note that if you use chown user: file (Note the left-out group), it will use the default group for that user.

Also You can change the group ownership of a file or directory with the command:

You must be a member of the group to which you are changing ownership to.

You can find group of file as follows

User 500 is just a normal user. Typically user 500 was the first user on the system, recent changes (to /etc/login.defs) has altered the minimum user id to 1000 in many distributions, so typically 1000 is now the first (non root) user.

What you may be seeing is a system which has been upgraded from the old state to the new state and still has some processes knocking about on uid 500. You can likely change it by first checking if your distro should indeed now use 1000, and if so alter the login.defs file yourself, the renumber the user account in /etc/passwd and chown/chgrp all their files, usually in /home/, then reboot.

But in answer to your question, no, you should not really be worried about this in all likelihood. It’ll be showing as «500» instead of a username because o user in /etc/passwd has a uid set of 500, that’s all.

Also you can show your current numbers using id i’m willing to bet it comes back as 1000 for you.

Источник

Change folder permissions and ownership

I would like the user to have full rights on this folder (as well as all sub-directories and files in it):

currently owned by root.

I have found numerous posts (in this forum and elsewhere) on how to do this for files but I can’t find a way to do it for whole folders.

8 Answers 8

Make the current user own everything inside the folder (and the folder itself):

/.blabla – quantme Jan 5 ’12 at 1:49

Use chown to change ownership and chmod to change rights.

As Paweł Karpiński said, use the -R option to apply the rights for all files inside of a directory too.

Note that both these commands just work for directories too. The -R option makes them also change the permissions for all files and directories inside of the directory.

will change ownership (both user and group) of all files and directories inside of directory and directory itself.

will only change the permission of the folder directory but will leave the files and folders inside the directory alone.

As enzotib mentioned, you need to use sudo to change the ownership from root to yourself.

Note that if you use chown : (Note the left-out group), it will use the default group for that user.

If you want to change only the group, you can use:

Источник

Change Ownership and Rights to Files and Folders in Linux

Correct working of applications, services and especially the security of server mainly depend on the assignment of permissions and allocation of ownership. Proper functionality of server-based operating systems like Linux, Windows or FreeBSD’s mainly depends on above said factors.

Wrong permissions may exploit your server to the execution of malicious code. while inappropriate ownership of files and folders may allow hackers to upload their script to your server. With proper user rights and permission, you can solve almost 90% of the problems that are caused due to the inappropriate settings of access rights.

Changing the Ownership of all Folders and files.

Correct assignment of ownership and permission is your first defense in server security. You are going to restrict or block other users and group from accessing and execution of the server data. Especially, in the shared server this is mandatory to restrict users to their own home, directories, and files to maintain the secrecy of other users.

Must Read: Simple, Reliable and Convenient Monitoring of Linux Servers. Read More →

Each file or folder is owned by specific user called UID and specific group called GID. Linux uses the chown command with different parameter as per need basis. First we will use listing command ls with -l switch to see the files and their owners and groups.

Источник

Change owner of the root folder and subfolders (Ubuntu 13.04) [closed]

Want to improve this question? Update the question so it’s on-topic for Stack Overflow.

Closed 7 years ago .

I accidentally set owner of root folder (/) and all subfolders to one user by command

Now I wanna set owner back to root user by command

But I have no permission for this operation. If i use command

What should I do to fix that?

3 Answers 3

I am guessing when you ran the first command you also ended up modifying the ownership of the /usr/bin/sudo executable.

It is saying that effective UID isn’t 0 (since root has EUID equal to 0).

So try to change owner of /usr/bin/sudo , and then try change the ownership of other files.

You broke your system pretty badly. Next time be more careful using sudo .

  • Now, start your system using a rescue disk, probably your install disk.
  • Mount your broken file system in the rescue system.
  • Fix the permission/owner stuff.
  • Reboot using your original system.

Depending on how much you changed using that chown , you will have to fix a lot in step 3. You probably might want to have a look at a working proper installation of the same system to find out which user should be the owner of things like /dev/mem etc.

A re-install of the OS might be faster.

:O I offer my condolence!

The problem is that the sudo binary itself must be owned by root. If you have the root password you could just get root to fix the problem:

If not, you could boot using a rescue system, mount the partition and

or fix the whole problem using the rescue system.

But it will be hard to fix all that ownerships. I would suggest to craft a script that reads the file ownerships from a vanilla installation of your system (having installed the same packages as you) and applies them to the crashed system. (Custom files in the /home/. you’ll have to chown yourself) Without such a script it will get really hard but it should be easy to code that

Источник

Can’t change the owner of a folder

I want to change the owner of a folder. The path to to that folder is /mnt/8A30AA8B30AA7DB7/Books . I want to take the ownership of that folder to change the permissions. The folder currently belongs to root. I tried the following connamds but none seem to work.

  1. chown apoorv_potnis -R Books
  2. sudo chown apoorv_potnis:apoorv_potnis -R Books
  3. sudo chown apoorv_potnis:apoorv_potnis -R /mnt/8A30AA8B30AA7DB7/Books
  4. sudo chown -R apoorv_potnis: /mnt/8A30AA8B30AA7DB7/Books

The terminal displays chown: changing ownership of ‘/mnt/8A30AA8B30AA7DB7/Books’: Read-only file system and other files in the folder but does not actually change the ownership. Whenever I check the properties of that folder or the sub-folders, the owner is shown to be root and I cannot change the permissions or delete any file of that folder. How can I take the ownership of the folder? I’m using Ubuntu 18.04 with dual boot Windows 10.

Источник

How do I change owner to current user on folder and containing folders inside my home directory?

Using sudo nautilus I created some folders and I want to get rid of root permission on them. But I have many and I want to do it to a entire directory and its containing folders.

So how to allow read/write to current user to all files and folders inside a specific directory that is inside home?

3 Answers 3

To revert damage done using sudo nautilus you should make yourself the owner of any directories (and their contents) that are owned by root.

You can use find to do this, as it has a test to find only files owned by a specific user.

This will find all the directories in your home owned by root:

You can then repeat the find command and add the action you want to do — recursively changing ownership of all the found directories and their contents to the current user:

Explanation:

the home directory

  • -type d find only directories
  • -user root find only stuff belonging to root
  • -exec do the following command on whatever was found
  • sudo chown -R recursively change owner
  • $USER the current user
  • : also change group to the specific user
  • More efficiently, you could omit the -type d to find files of any type belonging to root, and also omit the -R as find will do the recursion for you by acting on all the files

    Источник

    Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Mac how to reinstall os
  • Mac how to check os version
  • Mac fan control mac os настройка
  • Mac cursors os x
  • Mac carbon copy cloner mac os