1. Welcome to TechPowerUp Forums, Guest! Please check out our forum guidelines for info related to our community.

Locked out of drive on Ubuntu Server

Discussion in 'Linux / BSD / Mac OS X' started by <<Onafets>>, Nov 18, 2012.

  1. <<Onafets>>

    <<Onafets>>

    Joined:
    Nov 8, 2008
    Messages:
    779 (0.35/day)
    Thanks Received:
    77
    Location:
    Sydney, Australia
    Hey guys,
    I was trying to delete some torrents that I had downloaded with transmission-daemon and was unable to from my samba share on windows. I figured the best solution was to 'sudo chmod -R 0777 /media/Storage' (my drive with samba) but apparently not.
    This locked both my windows user and my user on my ubuntu server out of the drive completely with a message saying 'ls: cannot access /media/Storage: Permission denied'.
    I am able to login as root with 'sudo bash' and make changes however I am uncertain as to how to make my drive accessible again.
    Doing a 'ls -ld' on the directory shows 'drwsrwsrwx 39 root root 4096 Nov 17 21:20 /media/Storage'
    Any ideas? :confused:
     
  2. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,861 (6.48/day)
    Thanks Received:
    2,464
    Location:
    Concord, NH
    try chowning it first:

    Code:
    sudo chown -R [username]:[group] /to/some/path
    Then try granting user permissions.

    Code:
    sudo chmod -R u+rw /to/some/path
     
    <<Onafets>> says thanks.
  3. <<Onafets>>

    <<Onafets>>

    Joined:
    Nov 8, 2008
    Messages:
    779 (0.35/day)
    Thanks Received:
    77
    Location:
    Sydney, Australia
    Both commands executed without errors however I am still unable to access/ls the directory from either Windows or Ubuntu. Still getting the same 'ls: cannot access /media/Storage: Permission denied' message. :ohwell:
     
  4. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,861 (6.48/day)
    Thanks Received:
    2,464
    Location:
    Concord, NH
    Stop trying to access it in Windows until you can actually get into it in Linux.

    Is the drive even mounted?

    How does the output of
    Code:
    sudo mount
    look?
     
    <<Onafets>> says thanks.
  5. <<Onafets>>

    <<Onafets>>

    Joined:
    Nov 8, 2008
    Messages:
    779 (0.35/day)
    Thanks Received:
    77
    Location:
    Sydney, Australia
    sudo mount dumps
    Code:
    /dev/sdb1 on / type ext4 (rw,errors=remount-ro)
    proc on /proc type proc (rw,noexec,nosuid,nodev)
    sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
    none on /sys/fs/fuse/connections type fusectl (rw)
    none on /sys/kernel/debug type debugfs (rw)
    none on /sys/kernel/security type securityfs (rw)
    udev on /dev type devtmpfs (rw,mode=0755)
    devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=0620)
    tmpfs on /run type tmpfs (rw,noexec,nosuid,size=10%,mode=0755)
    none on /run/lock type tmpfs (rw,noexec,nosuid,nodev,size=5242880)
    none on /run/shm type tmpfs (rw,nosuid,nodev)
    /dev/sda1 on /media/Storage type ext4 (rw)
    
    /dev/sda1 on /media/Storage type ext4 (rw) is the drive
     
  6. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,861 (6.48/day)
    Thanks Received:
    2,464
    Location:
    Concord, NH
    So after you chmod and chown the directory, what does "ls -l /media/" show?

    Preferably a before and after would be nice.
     
    <<Onafets>> says thanks.
  7. <<Onafets>>

    <<Onafets>>

    Joined:
    Nov 8, 2008
    Messages:
    779 (0.35/day)
    Thanks Received:
    77
    Location:
    Sydney, Australia
    before
    Code:
    sudo ls -la /media/Storage
    drwsrwsrwx 39 root root 4096 Nov 17 21:20 /media/Storage
    after
    Code:
    ls -l /media
    ls: cannot access /media/cdrom: Permission denied
    ls: cannot access /media/Storage: Permission denied
    total 0
    d????????? ? ? ? ?            ? cdrom
    d????????? ? ? ? ?            ? Storage
    
    sudo ls -l
    total 8
    drwxr-xr-x  2 root      root      4096 Oct  8 20:30 cdrom
    drwsrwsrwx 39 onafets onafets 4096 Nov 17 21:20 Storage
    
    
    
     
  8. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,861 (6.48/day)
    Thanks Received:
    2,464
    Location:
    Concord, NH
    Hmmm, and you can't access it now? I'm assuming "onafets" is your account.

    When you restart are the permissions the same?

    These are the permissions that I have on my workstation for /media

    maybe

    Code:
    sudo chown -R root:root /media
    sudo chmod -R 775 /media
    Restart before you try anything else then tell me how it works. Also are you mounting the drive or is Ubuntu doing it for you?
     
    <<Onafets>> says thanks.
  9. <<Onafets>>

    <<Onafets>>

    Joined:
    Nov 8, 2008
    Messages:
    779 (0.35/day)
    Thanks Received:
    77
    Location:
    Sydney, Australia
    Code:
    sudo chmod -R 775 /media
    Allows me to access the drive and its contents however I ended up modifying it to 777 so I was able to delete my files. Thank you!
     
  10. Aquinus

    Aquinus Resident Wat-man

    Joined:
    Jan 28, 2012
    Messages:
    6,861 (6.48/day)
    Thanks Received:
    2,464
    Location:
    Concord, NH
    You're welcome but make sure you're setting the right permissions to the right directory.

    Code:
    sudo chown root:root /media
    sudo chmod 775 /media
    sudo chmod -R 777 /media/Storage
    Just make sure /media itself belongs to root and is chmod'ed to 775, even if Storage is 777.
     

Currently Active Users Viewing This Thread: 1 (0 members and 1 guest)

Share This Page