LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-16-2011, 01:43 AM   #1
nnjond
Member
 
Registered: Feb 2007
Distribution: Ubuntu 10.04
Posts: 281

Rep: Reputation: 31
Permissions command needs clarifying


Hi,

I've installed my os on a new HD, and it declines me permission to acces my Data dd. I seem to remember I should navigate to the drive and:

sudo -R 777 *

Could you fill me please?

An additional quiry is the failure to recognise my certain password in this specific instance:

nnjond@Den-GeForce6100PM-M2:~$ su
Password:
su: Authentication failure
nnjond@Den-GeForce6100PM-M2:~$

?
 
Old 04-16-2011, 01:59 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
I think you mean "chmod" not "sudo" the commands are very different. run "man chmod" for it's usage and function. You've said nothing about what data this is, what kind of partition, but doing a 777 is usually the very worst way to fix permissions issues, as what you're doing is to just make everything writable by everyone, which is horrible. There's probably a better way if you can give more details.

As for su, that's acking for the root password, not your password. an equivalent which uses *your* password is "sudo -i" assuming your sudoers file is configured to allow this.
 
1 members found this post helpful.
Old 04-16-2011, 02:47 AM   #3
nnjond
Member
 
Registered: Feb 2007
Distribution: Ubuntu 10.04
Posts: 281

Original Poster
Rep: Reputation: 31
Thanks for your help.

All my files (not sw) are on a second physical hdd, so it doesn't mater if I mess up my os.
I'm the only user of my pc so, I imagine 777 is no threat to my peace of mind.

If you can advise me on a more standard way of accessing my data drive on /media//,

I would be grateful. I hope that answers your questions.
 
Old 04-16-2011, 03:28 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,338
Blog Entries: 55

Rep: Reputation: 3538Reputation: 3538Reputation: 3538Reputation: 3538Reputation: 3538Reputation: 3538Reputation: 3538Reputation: 3538Reputation: 3538Reputation: 3538Reputation: 3538
Quote:
Originally Posted by nnjond View Post
All my files (not sw) are on a second physical hdd, so it doesn't mater if I mess up my os.
I'm the only user of my pc so, I imagine 777 is no threat to my peace of mind.
That may be your opinion but I'm afraid it's simply wrong: that what affects your setup may adversely affect the 'net community. Linux may be free to use but using it is not free of responsibilities.


Quote:
Originally Posted by nnjond View Post
If you can advise me on a more standard way of accessing my data drive on /media//,
First restore your file permissions then move on to other tasks. Since Debian-based distributions don't facilitate easy restoration of permissions here's a script from Ubuntuforums:
Code:
#!/bin/bash
# Restores file permissions for all files on a debian system for which .deb
# packages exist.
#
# Author: Larry Kagan <me at larrykagan dot com>
# Since 2007-02-20

ARCHIVE_DIR=/var/cache/apt/archives/
PACKAGES=`ls $ARCHIVE_DIR`
cd /

function changePerms()
{
    CHOWN="/bin/chown"
    CHMOD="/bin/chmod"
    PERMS=$1
    OWN=`echo $2 | /usr/bin/tr '/' ':'`
    PATHNAME=$3

    echo -e "$CHOWN $OWN $PATHNAME"
    #`$CHOWN $OWN $PATHNAME`
    #`$CHMOD $MODE $PATHNAME`
        
}

for PACKAGE in $PACKAGES;
do
    echo -e "Getting information for $PACKAGE\n"
    FILES=`/usr/bin/dpkg -c "${ARCHIVE_DIR}${PACKAGE}"`

    for FILE in "$FILES";
    do
        FILE_DETAILS=`echo "$FILE" | awk '{print $1"\t"$2"\t"$6}'`
        changePerms $FILE_DETAILS
    done
done
This may or may not work for you. If it does not then re-installing your distribution would be best. The fact that that's tedious, boring and a waste of time you will chalk up as a "lessons learnt" so you remember next time to read before you act.
 
Old 04-16-2011, 07:20 AM   #5
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ Reply

Hi nnjond,

unSpawn and acid_kewpie are right that you shouldn't be using 777 (Its not about the threat its about how you should set up your system in general) and as said by acid_kewpie I think it is not sudo it should be chmod

Also for your other query i.e. when you do su you get authentication failure. Which Linux flavor it is? If it is Ubuntu and you are logging in for the first time then you have reset the root password because Ubuntu does not ask you for root password during installation.

Have you ever logged in as root on this machine? Do you remember the root password? If not then reset the root password first :-)

Last edited by T3RM1NVT0R; 04-16-2011 at 07:21 AM.
 
Old 04-16-2011, 04:04 PM   #6
nnjond
Member
 
Registered: Feb 2007
Distribution: Ubuntu 10.04
Posts: 281

Original Poster
Rep: Reputation: 31
Thanks for your advice. I'm not sure how to follow it. My Ubuntu os is freshly installed and I haven't tried to alter the permisions. -But I am not permited to alter my files on a second physical hdd as this was established in another setup.

Should I just paste a sequence of the lines into the Bash terminal? I'm not sure where I should begin?
 
Old 04-16-2011, 04:35 PM   #7
yancek
LQ Guru
 
Registered: Apr 2008
Distribution: PCLinux, Slackware
Posts: 7,123

Rep: Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324Reputation: 1324
You're using Ubuntu and according to your post #3, your data drive is in the /media directory but you cannot access the drive of directories on it, correct.

You could post the info you see there so someone could help with whatever changes are needed. Click on the Applications tab at the top left of the Desktop and in the drop-down menu, look for Terminal and click it. Then run this: ls -l /media
This should show your directories which should include your second drive as well as whatever their permissions are.
 
Old 04-16-2011, 04:43 PM   #8
stress_junkie
Senior Member
 
Registered: Dec 2005
Location: Massachusetts, USA
Distribution: Ubuntu 10.04 and CentOS 5.5
Posts: 3,873

Rep: Reputation: 332Reputation: 332Reputation: 332Reputation: 332
One of the good things about Ubuntu is that it makes using an external disk easier than other Linux distributions.

You should plug in the drive then on your desktop near the top of the screen you should click on Places. Then you will see a list of directories AND you should see your external disk drive. Just click on the icon for your disk drive. Ubuntu will automatically mount it and it will set the permissions for you. It will also open a file explorer window at the same time.

BTW the file explorer in Ubuntu is called Nautilus.

Last edited by stress_junkie; 04-16-2011 at 04:45 PM.
 
Old 04-16-2011, 05:10 PM   #9
T3RM1NVT0R
Senior Member
 
Registered: Dec 2010
Location: Internet
Distribution: Linux Mint, SLES, CentOS, Red Hat
Posts: 2,385

Rep: Reputation: 477Reputation: 477Reputation: 477Reputation: 477Reputation: 477
@ nnjond

Alright for your query regarding authentication failure here is the solution:

http://www.myokyawhtun.com/ubuntu-li...or-ubuntu.html

Also read the following:

http://www.ubuntux.org/how-to-change...word-in-ubuntu

The first link says that by default there is no password set for root user in uBuntu which is not correct. It has been explained in the second link.

For your query related to permissions, we will get back on that once you are done with this.
 
Old 04-16-2011, 05:30 PM   #10
spazticclown
Member
 
Registered: Sep 2010
Distribution: Fedora, Android, CentOS
Posts: 91
Blog Entries: 2

Rep: Reputation: 21
Is the data drive formatted for NTFS or FAT32? If it is then you can just change the ownership of the mount point or even edit the fstab to grant ownership to your user.
Code:
$ su -c 'fdisk -l'
password:
This will print a list of your drives and partition types.

If the drive is EXT[234] or another non-windows partition then maybe changing the ownership rather than permissions would be a better bet?

This will change the entire drive ownership
Code:
$ su -c 'chown -R <username>:<groupname> <mount point of drive in question>'
password:
"su -c" gets you root permissions on the command in the single quotes. "chown -R" will change the ownership of all files, directories and subdirectories. "<username>" is just your user name. "<groupname>" is not necessary, if you don't use it take out the ":" also. "<mount point of drive in question>" can be something like "/media/sdb1" or "/media/C Drive" depending on where it is mounted.

Hope this helps.
 
Old 04-16-2011, 10:46 PM   #11
nnjond
Member
 
Registered: Feb 2007
Distribution: Ubuntu 10.04
Posts: 281

Original Poster
Rep: Reputation: 31
The procedure below seems to succeed except when I open an .odt doc on the drive in question it is read only and -'is locked for editing by yourself on a different system'


Code:
nnjond@Den-GeForce6100PM-M2:~$ sudo fdisk -l

Disk /dev/sdb: 2023 MB, 2023751680 bytes
255 heads, 63 sectors/track, 246 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000078f1

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1         246     1975963+   b  W95 FAT32

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cedbd

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        7725    62048092+  83  Linux
/dev/sda2            7725       30402   182149121    5  Extended
/dev/sda5           30020       30402     3068928   82  Linux swap / Solaris
/dev/sda6           15234       29669   115948544   83  Linux
/dev/sda7           29669       30019     2812928   82  Linux swap / Solaris
/dev/sda8            7725       14922    57807872   83  Linux
/dev/sda9           14922       15233     2500608   82  Linux swap / Solaris

Partition table entries are not in disk order

Disk /dev/sdd: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ea57a

   Device Boot      Start         End      Blocks   Id  System
/dev/sdd1               1      121602   976760832   83  Linux
nnjond@Den-GeForce6100PM-M2:~$ sudo chown -R nnjond /media/sdb1
chown: cannot access `/media/sdb1': No such file or directory
nnjond@Den-GeForce6100PM-M2:~$ sudo chown -R nnjond /dev/sdb1
nnjond@Den-GeForce6100PM-M2:~$
 
Old 04-17-2011, 08:08 AM   #12
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
fat32! Pfft. so assuming you wish to share this drive with windows machines and the likes, then you can keep it as fat32. However, fat32 is NOT a posix (unix) compliant filesystem. As such, it has no concept of file ownership and access rights in the filesystem itself. Consequently chmod will do nothing. You traditionally need to mount it with "fake" rights - "mount /dev/sdb1 /mnt/my_drive -o umask=000" etc, which wold make all the files world accessible. Under Gnome I'm not really sure what the easy user enhancements are in the GUI world, but just plugging it in should make then fully accessible through Gnome.
 
Old 04-18-2011, 12:49 AM   #13
malekmustaq
Senior Member
 
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,618

Rep: Reputation: 444Reputation: 444Reputation: 444Reputation: 444Reputation: 444
nnjondk,

acid_kewpie is right. FAT16,32 cannot help you control ownership. If it doesn't cost you any data you may reformat that /dev/sdb1 into a linux format.

As a matter of experience MS file systems are a security risk. My advice is always to format every volume into a linux or unix filesystem before using them. Just imagine you issuing an option of umask=0000 ! in the fstab, nothing can be more promiscuous than that: I certainly cannot allow my disk nor my files behave like prostitutes in another hands. Lol (joke).

Hope it helps.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Linux: Clarifying the ath5k License LXer Syndicated Linux News 0 09-07-2007 10:20 PM
LXer: Clarifying the types of software, their use LXer Syndicated Linux News 0 06-25-2006 05:33 PM
file permissions OK, but command permissions? stabu Linux - General 2 10-05-2005 12:00 PM
Some LQ rules need clarifying vharishankar LQ Suggestions & Feedback 13 08-18-2005 04:42 PM
Clarifying Linux & filename extensions Gag Halfrunt Linux - Newbie 1 11-28-2004 06:44 AM


All times are GMT -5. The time now is 04:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration