Change directory ownership on mounted drive

I have a dual-boot Windows 10/Xubuntu 16.04 set up. Both share the small SSD for boot, and both have home directories on the data drives.

For Xubuntu, /dev/sdc is the data drive, and it's mounted at /mnt/archives. When I ran usermod -d /mnt/archives/mike mike against my user to move my home drive to the data drive, it worked just fine after a reboot. When I originally changed my home directory, I had /dev/sdc mount under id=0,gid=0, which was mounting everything as root. I changed the mount to id=mike,gid=mount_group, and rebooted my computer. However, when I go to run sudo chown -R mike:mount_group /mnt/archives/mike/*, it doesn't actually change any of the permissions. :/

Here is my /etc/fstab file:

# cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
# / was on /dev/sdd3 during installation
UUID=8db38c8f-87b6-4174-a439-fd60dbb7b313 / ext4 errors=remount-ro 0 1
/dev/sdc /mnt/archives auto rw,relatime,user_id=mike,group_id=mount_group,allow_other,blksize=4096

Here is a sample of the directory:

# ls -lah /mnt/archives/mike/
total 88K
drwxrwxrwx 1 root root 8.0K Oct 23 15:50 .
drwxrwxrwx 1 root root 4.0K Oct 23 14:30 ..
drwxrwxrwx 1 root root 0 Oct 3 23:05 .adobe
drwxrwxrwx 1 root root 4.0K Oct 3 23:36 anaconda2
drwxrwxrwx 1 root root 0 Oct 9 00:14 .astropy
drwxrwxrwx 1 root root 0 Oct 9 00:19 .aws
-rwxrwxrwx 1 root root 6.5K Oct 23 15:49 .bash_history
-rwxrwxrwx 1 root root 220 Oct 3 22:24 .bash_logout
-rwxrwxrwx 1 root root 948 Oct 23 14:33 .bash_profile
-rwxrwxrwx 1 root root 3.8K Oct 23 14:34 .bashrc
-rwxrwxrwx 1 root root 3.7K Oct 3 23:36 .bashrc-anaconda2.bak
drwxrwxrwx 1 root root 4.0K Oct 23 16:01 .cache
drwxrwxrwx 1 root root 0 Oct 8 17:21 .conda
...

How can I fix this odd permissions issue?

1

1 Answer

The problem is in your chmod -R command. The * in the command is excluding the actual mike/ portion of your space. By default the * doesn't see the dot . in the intended immediate directory.

These are commands that will achieve what you are looking for. First, it's common for users to mistakenly change owner of their home's root director or some of the files and folders in their space. This can be corrected with:

$ sudo chown -R $USER:$USER ~/

or in the case of the command in your question, use this:

$ sudo chown -R mike:mount_group /mnt/archives/mike/
5

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like