[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: smbmount w2k3 no write access



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 26 Aug 2004, Jody Grafals wrote:

> If I can't get the thing to mount the way I want it, Can I somehow give the
> user (myself) root access to this directory?

Yes. Use sudo. apt-get install sudo first (if you don't have it)

Create a script in /usr/local/bin, call it, say, smbmounthack, put the
commands that you need to execute as root in it, and edit /etc/sudoers to
authorize yourself to perform the desired action as root.

The following is clipped from an email I posted to this list a couple days
ago. :)

Okay, here's an example. On my laptop, I want to let ordinary users shut
the machine down. Of course, /sbin/shutdown is root only, as it should be
(ugh, setuid is bad).

In /etc/sudoers, I have:
User_Alias      USERS = {my user list}
Cmnd_Alias      SHUTDOWN = /usr/local/sbin/shutdown.sh
Cmnd_Alias      NTPDATE = /etc/init.d/ntpdate
USERS   ALL = NOPASSWD: SHUTDOWN, NTPDATE

That allows users to run shutdown.sh and ntpdate (but only from the init.d
script, not ntpdate by itself, which means that they can't change the
server that ntpdate uses).

shutdown.sh looks like this:
#! /bin/sh
#
# Meant to be used as a target for sudo to allow users to gracefully
# shutdown the laptop.

case "$1" in
  restart)
	/sbin/shutdown -r now
	;;
  shutdown)
	/sbin/shutdown -h now
	;;
  *)
	echo "Usage: shutdown.sh {restart|shutdown}" >&2
	exit 1
	;;
esac

exit 0

This prevents users from using any other modifiers to shutdown.

So in my other scripts (I have some that call Xdialog to confirm shutdown
or restart), I use sudo /usr/local/sbin/shutdown.sh shutdown or
sudo /usr/local/sbin/shutdown.sh restart to allow users to shutdown or
restart.

You would probably want targets like mount) and unmount) in your script.

This is, of course, assuming that you never figure out how to mount the
SMB share normally. (Perhaps smbmount needs to open a priviledged port, or
something?)
- -- 
GnuPG public key available from
http://ca.geocities.com/redvision.geo/gnupg_key.html
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)

iD8DBQFBLrRcMqUhaD+LmFcRAoWBAJ9T6sQuopNdVSyhpIo7sOuqr6cY8QCdGByZ
bDMY166Y8c3Qh+8LIX7bKno=
=3rND
-----END PGP SIGNATURE-----



Reply to: