PCWorld Forums

PCWorld Forums: How Do I Change A Directory's Ownership? - PCWorld Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How Do I Change A Directory's Ownership? The dreaded terminal emulator

#1 User is offline   publicmenace 

  • Advanced Member
  • PipPipPipPip
  • Group: Members
  • Posts: 254
  • Joined: 06-December 07

Posted 06 February 2010 - 03:27 AM

What specific syntax would I use to change the ownership of a directory to my user name? I have a directory called "Data" in /media that is currently owned by "root" and I would like to change the ownership to "tmr". I haven't been able to figure out the correct chown argument to effect this change. The directory "Data" is actually an NTFS partition so maybe Linux won't let me do this, although how changing ownership of this directory from root to tmr could be a bad thing is beyond me.

This is what I've tried so far:

tmr@compaqowner:~$ sudo chown tmr /media/Data
[sudo] password for tmr: 
tmr@compaqowner:~$ cd /media
tmr@compaqowner:/media$ chown -R tmr Data
tmr@compaqowner:/media$



Nothing. Still owned by root. I've strained my feeble Linux muscles to their limit and have no idea what I'm not doing correctly :( .

This post has been edited by publicmenace: 06 February 2010 - 03:29 AM

0

#2 User is offline   smax013 

  • Member
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 12,953
  • Joined: 28-January 07

Posted 06 February 2010 - 01:41 PM

View Postpublicmenace, on 06 February 2010 - 03:27 AM, said:

What specific syntax would I use to change the ownership of a directory to my user name? I have a directory called "Data" in /media that is currently owned by "root" and I would like to change the ownership to "tmr". I haven't been able to figure out the correct chown argument to effect this change. The directory "Data" is actually an NTFS partition so maybe Linux won't let me do this, although how changing ownership of this directory from root to tmr could be a bad thing is beyond me.

This is what I've tried so far:

tmr@compaqowner:~$ sudo chown tmr /media/Data
[sudo] password for tmr: 
tmr@compaqowner:~$ cd /media
tmr@compaqowner:/media$ chown -R tmr Data
tmr@compaqowner:/media$



Nothing. Still owned by root. I've strained my feeble Linux muscles to their limit and have no idea what I'm not doing correctly :( .


While I could be wrong, I believe the part in red is your problem. If I recall correctly, things like file and directory permissions are typically linked to the drive format type.
0

#3 User is offline   waldojim 

  • Elite
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 15,065
  • Joined: 29-October 08
  • Location:Texas

Posted 06 February 2010 - 03:49 PM

change the directory permissions before you mount the ntfs. Then be sure to mount it with the 'users' option so that it is available to more than just 'root'...
"There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that 'my ignorance is just as good as your knowledge.'" -- Isaac Asimov

Lenovo W520 CTO Intel i7-2620m, 8GB Patriot ram @ 1333Mhz, Nvidia Quadro 1000m with 2GB GDRR3, Plextor M3 256GB SSD, 1080P wide color display, Windows 8 Pro
Media Center: Intel Core i5 760 @ 3.1Ghz, 4GB DDR3, Corsair GS600PSU, EVGA Geforce 550ti, EVGA P55 SLI, 3x 1TB raid 5, 1x 1TB boot drive, Windows 8 Pro, Win TV 950(USB), Pioneer BR.
Server: AMD Phenom X4 945 @ 3.0Ghz, MSI 790FX-GD70, 16gb ddr3 RAM @ 1333mhz, 2TB Seagate HDD, 64GB Patriot SSD, Asus Silent Gefore 210
The Green machine: AMD Sempron 145EE Unlocked and OC'd to 4.1Ghz, Gigabyte GD970A-DS3, 8GB ram @ 1600mhz, Nvidia 550Ti, Thermaltake BlueOrb, Antec EW385
Samsung Galaxy Nexus, Paranoid Android 4.2 Rom http://www.speedtest...d/315465831.png
0

#4 User is offline   publicmenace 

  • Advanced Member
  • PipPipPipPip
  • Group: Members
  • Posts: 254
  • Joined: 06-December 07

Posted 07 February 2010 - 03:50 AM

View Postwaldojim, on 06 February 2010 - 03:49 PM, said:

change the directory permissions before you mount the ntfs. Then be sure to mount it with the 'users' option so that it is available to more than just 'root'...

I have the NTFS partition configured to automount (the subject of one of my previous posts) at start-up. So if I unmount the partition and reset the permissions will that be permanent or is it something I would have to do each time the partition remounted after a restart?

The current permissions are "Create and delete files" for Owner, Group and Others so the current state doesn't inconvenience me in any way but I don't like "Others" to have those kinds of rights. It makes me a little nervous to have one of my drives "World writable."

Okay, here we go:

tmr@compaqowner:/media$ sudo umount Data -v
/dev/sda2 umounted
tmr@compaqowner:/media$ chown -R tmr Data
chown: changing ownership of `Data': Operation not permitted
tmr@compaqowner:/media$

Oh, boy. Now my puny Linux muscles are really trembling. Bash indicates that the drive has been unmounted but it still won't let me change permissions. But when I go into /media using the file browser and right-click on Data it shows an unmount selection in the context menu, which indicates to me that the drive is still mounted, although the icon disappeared from my desktop.

This post has been edited by publicmenace: 07 February 2010 - 04:35 AM

0

#5 User is offline   waldojim 

  • Elite
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 15,065
  • Joined: 29-October 08
  • Location:Texas

Posted 07 February 2010 - 01:56 PM

you may need to change ownership as the super user - try adding sudo to the beginning of that command
"There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that 'my ignorance is just as good as your knowledge.'" -- Isaac Asimov

Lenovo W520 CTO Intel i7-2620m, 8GB Patriot ram @ 1333Mhz, Nvidia Quadro 1000m with 2GB GDRR3, Plextor M3 256GB SSD, 1080P wide color display, Windows 8 Pro
Media Center: Intel Core i5 760 @ 3.1Ghz, 4GB DDR3, Corsair GS600PSU, EVGA Geforce 550ti, EVGA P55 SLI, 3x 1TB raid 5, 1x 1TB boot drive, Windows 8 Pro, Win TV 950(USB), Pioneer BR.
Server: AMD Phenom X4 945 @ 3.0Ghz, MSI 790FX-GD70, 16gb ddr3 RAM @ 1333mhz, 2TB Seagate HDD, 64GB Patriot SSD, Asus Silent Gefore 210
The Green machine: AMD Sempron 145EE Unlocked and OC'd to 4.1Ghz, Gigabyte GD970A-DS3, 8GB ram @ 1600mhz, Nvidia 550Ti, Thermaltake BlueOrb, Antec EW385
Samsung Galaxy Nexus, Paranoid Android 4.2 Rom http://www.speedtest...d/315465831.png
0

#6 User is offline   publicmenace 

  • Advanced Member
  • PipPipPipPip
  • Group: Members
  • Posts: 254
  • Joined: 06-December 07

Posted 09 February 2010 - 08:35 AM

View Postwaldojim, on 07 February 2010 - 01:56 PM, said:

you may need to change ownership as the super user - try adding sudo to the beginning of that command

I did do the sudo thingy right before the umount command, if you look closely, jim. I assumed that I was still sudo when I did the chown command. You don't have to type sudo at the beginning of every command, do you? I thought you stayed superuser for the whole session. Right now I'm in MS land so I can't play around with it.
0

#7 User is offline   waldojim 

  • Elite
  • PipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 15,065
  • Joined: 29-October 08
  • Location:Texas

Posted 11 February 2010 - 05:43 PM

sudo requires it for every command

you could also use "sudo su" to continue as root user, then you don't have to.
"There is a cult of ignorance in the United States, and there always has been. The strain of anti-intellectualism has been a constant thread winding its way through our political and cultural life, nurtured by the false notion that democracy means that 'my ignorance is just as good as your knowledge.'" -- Isaac Asimov

Lenovo W520 CTO Intel i7-2620m, 8GB Patriot ram @ 1333Mhz, Nvidia Quadro 1000m with 2GB GDRR3, Plextor M3 256GB SSD, 1080P wide color display, Windows 8 Pro
Media Center: Intel Core i5 760 @ 3.1Ghz, 4GB DDR3, Corsair GS600PSU, EVGA Geforce 550ti, EVGA P55 SLI, 3x 1TB raid 5, 1x 1TB boot drive, Windows 8 Pro, Win TV 950(USB), Pioneer BR.
Server: AMD Phenom X4 945 @ 3.0Ghz, MSI 790FX-GD70, 16gb ddr3 RAM @ 1333mhz, 2TB Seagate HDD, 64GB Patriot SSD, Asus Silent Gefore 210
The Green machine: AMD Sempron 145EE Unlocked and OC'd to 4.1Ghz, Gigabyte GD970A-DS3, 8GB ram @ 1600mhz, Nvidia 550Ti, Thermaltake BlueOrb, Antec EW385
Samsung Galaxy Nexus, Paranoid Android 4.2 Rom http://www.speedtest...d/315465831.png
0

#8 User is offline   publicmenace 

  • Advanced Member
  • PipPipPipPip
  • Group: Members
  • Posts: 254
  • Joined: 06-December 07

Posted 16 February 2010 - 05:44 AM

View Postwaldojim, on 11 February 2010 - 05:43 PM, said:

sudo requires it for every command

you could also use "sudo su" to continue as root user, then you don't have to.

Okay, that did the trick. Thanks, jim. Now I own my NTFS partition and "Others" don't have any permissions. Yee-haw!
0

#9 User is offline   bantian602 

  • Newbie
  • Pip
  • Group: Members
  • Posts: 1
  • Joined: 03-May 10

Posted 04 May 2010 - 10:26 PM

chmod 777 directory
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users