Slackware This Forum is for the discussion of Slackware Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-02-2006, 09:27 AM
|
#1
|
LQ Newbie
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12
Rep:
|
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....
|
|
|
03-02-2006, 10:04 AM
|
#2
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
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.
|
|
|
03-06-2006, 09:56 AM
|
#3
|
LQ Newbie
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12
Original Poster
Rep:
|
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
|
|
|
03-06-2006, 10:29 AM
|
#4
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
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.
|
|
|
03-06-2006, 10:58 AM
|
#5
|
Member
Registered: Apr 2005
Location: Havant, Hampshire, UK
Distribution: Slamd64, Slackware, PS2Linux
Posts: 465
Rep:
|
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.
|
|
|
03-06-2006, 11:04 AM
|
#6
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
Hi,
@piete: Good points!
Sometimes I forget the 'obvious' (for me that is!) parts 
|
|
|
03-06-2006, 11:05 AM
|
#7
|
LQ Newbie
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12
Original Poster
Rep:
|
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
|
|
|
03-06-2006, 11:17 AM
|
#8
|
LQ Newbie
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12
Original Poster
Rep:
|
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 ?
|
|
|
03-06-2006, 12:10 PM
|
#9
|
LQ Newbie
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12
Original Poster
Rep:
|
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?
|
|
|
03-06-2006, 12:49 PM
|
#10
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
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.
|
|
|
03-06-2006, 12:52 PM
|
#11
|
LQ Newbie
Registered: Feb 2006
Distribution: slackware 10.0
Posts: 12
Original Poster
Rep:
|
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
|
|
|
All times are GMT -5. The time now is 04:25 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|