Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.user > #170667
| From | Ken Heard <kenslists@teksavvy.com> |
|---|---|
| Newsgroups | linux.debian.user |
| Subject | Re: Using sudo in a script. |
| Date | 2016-08-03 23:30 +0200 |
| Message-ID | <s2bTI-81W-1@gated-at.bofh.it> (permalink) |
| References | <s27n9-4Sd-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 2016-08-03 12:21, Ken Heard wrote: > I would like to create a short script to mount and unmount SCXC > cards. For these exfat cards to do either in Jessie has to be done > as root. > > I have set up sudo so that my user can run any command as root. > the following command will mount the card without asking for my > password. > > sudo mount -U 6238-3434 /media/xca > > (My file /etc/fstab contains the following line: > > UUID-6238-3434 /media/xca exfat rw,users,noauto,noatime 0 > 0) > > In order to automate the process I wrote the following script named > mxca : > > #!/bin/bash # Script to mount xca from any directory. CURPWD=$PWD > cd /home/ken sudo mount -U 6238-3434 /media/xca cd $CURPWD > > Running mxca alone does not produce the required result. Running > sudo mxca together however does, even though the sudo command is > also in the script. > > I can unmount the card by running command sudo umount /media/xca, > but I would like a similar script named uxca to do the same thing > for unmounting. > > Is there a way to make sudo do its thing in these scripts so that > I can mount and unmount the SDXC card by running the script > commands mxca and uxca by themselves? I have since discovered a command "/sbin/mount.fuse" and "fusermount - -u" which are supposed to allow a non-privileged user to mount and unmount exfat devices; but I haven't figured out how to use them yet. A simple "/sbin/mount.fuse /media/xca" or "fusermount -u /media/xca" do not work. Other than fixing the format of the UUID device indicate from UUID- to UUID= I have yet to experiment with Don Armstrong's other suggestions. I thing I would rather get /sbin/mount.fuse and fusermount -u to work instead. Regards, Ken -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iEYEARECAAYFAleiYSoACgkQlNlJzOkJmTe4fwCcDvq8eBcq0I7guGdmmhN23sgP 3KEAn0LJKJzJUlIJTD0jMMt3T4CyXWAw =lclv -----END PGP SIGNATURE-----
Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Using sudo in a script. Ken Heard <kenslists@teksavvy.com> - 2016-08-03 18:40 +0200
Re: Using sudo in a script. Don Armstrong <don@debian.org> - 2016-08-03 19:30 +0200
Re: Using sudo in a script. Ken Heard <kenslists@teksavvy.com> - 2016-08-03 23:30 +0200
Re: Using sudo in a script. Ken Heard <kenslists@teksavvy.com> - 2016-08-03 23:30 +0200
Re: Using sudo in a script. deloptes <deloptes@gmail.com> - 2016-08-04 02:10 +0200
csiph-web