LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 03-02-2006, 09:27 AM   #1
carmelo
LQ Newbie
 
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12

Rep: Reputation: 0
How to mount like simple user


Hello to everybody, my question is :
is possible to allow simple users to mount floppy or cdrom?
if yes what should i do?

thanks in advance.

P.S.sorry if my question is too silly....
 
Old 03-02-2006, 10:04 AM   #2
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

This line in your /etc/fstab will do the trick (in this case: mount a floppy):

Code:
/dev/fd0      /mnt/floppy        auto      noauto,rw,user   0 0
Don't know what you do/don't know about this, so here's a small explenation (from left to right):

/dev/fd0 => points to your floppy device
/mnt/floppy => the mountpoint for the floppy (should exist)
auto => guess the filesystem (could be a unix or dos floppy, to name just 2)
noauto => do not mount during boot
rw => mount floppy read/write
user => anybody can mount this device (this is the one you are asking for)
0 0 => have to do with dump/fsck, 0 means no check.

Take a look at man mount for more options and details.

Hope this helps.

Quote:
P.S.sorry if my question is too silly....
The only silly question is the one that is not asked.

Last edited by anon237; 03-02-2006 at 10:06 AM.
 
Old 03-06-2006, 09:56 AM   #3
carmelo
LQ Newbie
 
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by druuna
Hi,

This line in your /etc/fstab will do the trick (in this case: mount a floppy):

Code:
/dev/fd0      /mnt/floppy        auto      noauto,rw,user   0 0
Don't know what you do/don't know about this, so here's a small explenation (from left to right):

/dev/fd0 => points to your floppy device
/mnt/floppy => the mountpoint for the floppy (should exist)
auto => guess the filesystem (could be a unix or dos floppy, to name just 2)
noauto => do not mount during boot
rw => mount floppy read/write
user => anybody can mount this device (this is the one you are asking for)
0 0 => have to do with dump/fsck, 0 means no check.

Take a look at man mount for more options and details.

Hope this helps.


The only silly question is the one that is not asked.
Hi Druna thanks so much for your attention

this is the line in my fstab fle:

/dev/fd0 /mnt/floppy auto noauto,rw,user 0 0

i tried to mount floppy like normal user
using the command:

mount /dev/fd0 /mnt/floppy

but the answer is :

mount: only root can do that

so what can i do?
thanks
 
Old 03-06-2006, 10:29 AM   #4
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi again,

The line given should do the trick.

I do recall that certain distro's remove the sticky bits of the mount program (makes it safer, but less flexible).

mount should reside in /bin. Do a ls -l /bin/mount, the output should look like this:

$ ls -l /bin/mount
-rwsr-xr-x 1 root root 64764 May 30 2004 /bin/mount

The bold part is what you need to look at, if it doesn't look like above but something like this: -rwx------ (no s anywhere), the permissions have been changed.

To return to the original setting do (as root):

chmod 4755 /bin/mount

If the permissions of the mount command are not the problem........

Well, only other thing I can come up with is the following: Is the user trying to mount the floppy member of the /dev/fd0 group? Type id when logged in as that user (or an id <user> as root). The 'floppy' group should be present in the groups=......... list.

If not, make that user a member of that group:

usermod -G <floppygroup> <user>

WARNING
If there are any groups mentioned in the groups= list, these need to be added again (minus the primary group), otherwise they are gone!!!
WARNING

Example:

$ id megalodon
uid=502(megalodon) gid=501(users) groups=501(users),400(visitor)

$ usermod -G floppy,visitor megalodon

$ id megalodon
uid=502(megalodon) gid=501(users) groups=501(users),78(floppy),400(visitor)

In the above example users is the default group, visitor is already present. To add floppy you need to include visitor in the usermod line.

If anything is unclear, just ask.

Hope this helps.

Last edited by anon237; 03-06-2006 at 10:35 AM.
 
Old 03-06-2006, 10:58 AM   #5
piete
Member
 
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465

Rep: Reputation: 44
Just for completeness I'd like to add a couple of things:

1. in fstab you can have "user" or "users" as a part of your mount line. The difference is "user" will only let the user who mounted the resource unmount it, while "users" will let any user unmount the resource, even if they didn't mount it. Useful to know if you're using it in a multiuser environment.

2. to use mount as a user from fstab you should only pass one argument to mount: the device or the mount point.

Code:
~$ mount /mnt/floppy
~$ mount /dev/fd0
Mount will intelligently look through fstab to see what it can find and match a rule based on what's in fstab. It stops you dynamically moving mountpoints, which surely is a security issue. Being in a single-user environment I don't really see anything malicious, but, there we go =)

- Piete.
 
Old 03-06-2006, 11:04 AM   #6
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

@piete: Good points!

Sometimes I forget the 'obvious' (for me that is!) parts
 
Old 03-06-2006, 11:05 AM   #7
carmelo
LQ Newbie
 
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by druuna
Hi again,

The line given should do the trick.

I do recall that certain distro's remove the sticky bits of the mount program (makes it safer, but less flexible).

mount should reside in /bin. Do a ls -l /bin/mount, the output should look like this:

$ ls -l /bin/mount
-rwsr-xr-x 1 root root 64764 May 30 2004 /bin/mount

The bold part is what you need to look at, if it doesn't look like above but something like this: -rwx------ (no s anywhere), the permissions have been changed.

To return to the original setting do (as root):

chmod 4755 /bin/mount

If the permissions of the mount command are not the problem........

Well, only other thing I can come up with is the following: Is the user trying to mount the floppy member of the /dev/fd0 group? Type id when logged in as that user (or an id <user> as root). The 'floppy' group should be present in the groups=......... list.

If not, make that user a member of that group:

usermod -G <floppygroup> <user>

WARNING
If there are any groups mentioned in the groups= list, these need to be added again (minus the primary group), otherwise they are gone!!!
WARNING

Example:

$ id megalodon
uid=502(megalodon) gid=501(users) groups=501(users),400(visitor)

$ usermod -G floppy,visitor megalodon

$ id megalodon
uid=502(megalodon) gid=501(users) groups=501(users),78(floppy),400(visitor)

In the above example users is the default group, visitor is already present. To add floppy you need to include visitor in the usermod line.

If anything is unclear, just ask.

Hope this helps.
Hi again...well the permissions of the mount command are not the problem i think becouse the output is this:

-rwsr-xr-x 1 root bin 68804 2004-5-27 23:26 /bin/mount

after that i logged like user(carmelo) and i typed :
id carmelo ...this is the output:
uid:1000(carmelo) gid=100(users)groups=100(users),11(floppy)

i think is all like you said ...but doesn't work
 
Old 03-06-2006, 11:17 AM   #8
carmelo
LQ Newbie
 
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by carmelo
Hi again...well the permissions of the mount command are not the problem i think becouse the output is this:

-rwsr-xr-x 1 root bin 68804 2004-5-27 23:26 /bin/mount

after that i logged like user(carmelo) and i typed :
id carmelo ...this is the output:
uid:1000(carmelo) gid=100(users)groups=100(users),11(floppy)

i think is all like you said ...but doesn't work
ok thanks druna thanks piete!
this is the story ....if i try to mount using :

mount /dev/fd0 /mnt/floppy
it doesn't work he says....only root can do that

if i mount using just :
mount /mnt/floppy or
mount /dev/fd0
it works....well why ?
 
Old 03-06-2006, 12:10 PM   #9
carmelo
LQ Newbie
 
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by carmelo
ok thanks druna thanks piete!
this is the story ....if i try to mount using :

mount /dev/fd0 /mnt/floppy
it doesn't work he says....only root can do that

if i mount using just :
mount /mnt/floppy or
mount /dev/fd0
it works....well why ?

but in this way every user can mount floppy and i wish only carmelo can do that....so how can i do?
 
Old 03-06-2006, 12:49 PM   #10
anon237
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

Works as designed

When you use something like mount /dev/fd0 or mount /mnt/floppy, mount will look in the /etc/fstab file to find the 'missing' information. When you use mount /dev/fd0 /mnt/floppy mount will not use the fstab file. To my knowledge the /etc/fstab file is the only place you can tell (using user/users) thet normal users can mount something.

Thus, trying to mount directly as normal user will cause an error message.

Only normal way to make sure that one (or a select group) user can use mount is to remove mounts sticky bit and use sudo.

Hope this helps.
 
Old 03-06-2006, 12:52 PM   #11
carmelo
LQ Newbie
 
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by druuna
Hi,

Works as designed

When you use something like mount /dev/fd0 or mount /mnt/floppy, mount will look in the /etc/fstab file to find the 'missing' information. When you use mount /dev/fd0 /mnt/floppy mount will not use the fstab file. To my knowledge the /etc/fstab file is the only place you can tell (using user/users) thet normal users can mount something.

Thus, trying to mount directly as normal user will cause an error message.

Only normal way to make sure that one (or a select group) user can use mount is to remove mounts sticky bit and use sudo.

Hope this helps.
Thanks Druna you were so kind
 
  


Reply

Tags
mounting


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
How to give not-root user ability to mount devices to any mount point??? jdupre Linux - General 8 02-04-2012 10:03 AM
user cant mount after chmod 777 /bin/mount misterwiddle Linux - General 2 04-06-2005 05:36 PM
Simple New user Problems. rvijay Debian 2 02-17-2005 06:04 PM
very simple user question roAder Slackware 8 02-14-2005 01:58 PM
Simple question about mount command Manuel Tejada Linux - General 3 11-02-2002 10:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 04:25 AM.

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
Open Source Consulting | Domain Registration