sudoers

sudoers

am 09.07.2008 15:19:57 von gamito

Hi,

I need to run /bin/mount and /sbin/mount.cifs commands as nobody user
(it has (bin/bash shell).

So, I've edited /etc/sudoers and added:

Cmnd_Alias CMD_MOUNT =3D /bin/mount
Cmnd_Alias CMD_CIFS ) =3D /sbin/mount.cifs

nobody ALL =3D NOPASSWD: CMD_MOUNT
nobody ALL =3D NOPASSWD: CMD_CIFS

But when I run the command as nobody (in the shell), I get the error:
"mount error 1 =3D Operation not permitted"

Any ideas ?

Any help would be appreciated.

Warm Regards,
M=E1rio Gamito
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: sudoers

am 09.07.2008 15:53:11 von gamito

Hi,

Your command (sudo mount -t cifs ...) works running as root.
Problem is that I need to run it from PHP and in this way, it doesn't m=
ount.

I have the ownership and permissions of the mount point set correctly.

As it is a dynamic application, the mount point always changes
(/mnt/user1, /mnt/user2, etc.), so, /etc/fstab is not an option :(

Any ideas ?

Warm Regards,
M=E1rio Gamito

On Wed, Jul 9, 2008 at 2:32 PM, nmaupu@excilys.com =
wrote:
> M=E1rio Gamito a =E9crit :
>>
>> Hi,
>>
>> I need to run /bin/mount and /sbin/mount.cifs commands as nobody use=
r
>> (it has (bin/bash shell).
>>
>> So, I've edited /etc/sudoers and added:
>>
>> Cmnd_Alias CMD_MOUNT =3D /bin/mount
>> Cmnd_Alias CMD_CIFS ) =3D /sbin/mount.cifs
>>
>> nobody ALL =3D NOPASSWD: CMD_MOUNT
>> nobody ALL =3D NOPASSWD: CMD_CIFS
>>
>> But when I run the command as nobody (in the shell), I get the error=
:
>> "mount error 1 =3D Operation not permitted"
>>
>> Any ideas ?
>
> Does mount point have nobody user/group permission ?
>
> sudo chown -R nobody:nobody /path/to/mount/point
> sudo mount -t cifs ...
>
> It is also possible to do that with user option directly in fstab whi=
ch will
> not use root privileges to mount your fs.
>
> A+
> NM
>
--
To unsubscribe from this list: send the line "unsubscribe linux-admin" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

Re: sudoers

am 09.07.2008 15:56:35 von nmaupu

M=E1rio Gamito a =E9crit :
> Hi,
>
> I need to run /bin/mount and /sbin/mount.cifs commands as nobody user
> (it has (bin/bash shell).
>
> So, I've edited /etc/sudoers and added:
>
> Cmnd_Alias CMD_MOUNT =3D /bin/mount
> Cmnd_Alias CMD_CIFS ) =3D /sbin/mount.cifs
>
> nobody ALL =3D NOPASSWD: CMD_MOUNT
> nobody ALL =3D NOPASSWD: CMD_CIFS
>
> But when I run the command as nobody (in the shell), I get the error:
> "mount error 1 =3D Operation not permitted"
>
> Any ideas ?
Error, sending to the list, I resend message for everybody :

-----

Does mount point have nobody user/group permission ?

sudo chown -R nobody:nobody /path/to/mount/point
sudo mount -t cifs ...

It is also possible to do that with user option directly in fstab which=
=20
will not use root privileges to mount your fs.

A+
NM

--
To unsubscribe from this list: send the line "unsubscribe linux-admin" =
in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html