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.
|
|
04-16-2006, 11:35 AM
|
#1
|
Member
Registered: Feb 2005
Distribution: Mint, Raspbian
Posts: 34
Rep:
|
usb mount permissions
I would like to be able for users to mount usb drives. This is on a 10.2 Slackware install.
I added this line in fstab:
Code:
/dev/sda1 /mnt/usbdrive vfat noauto,user,rw 0 0
Here are the permissions for the /mnt/usbdrive directory:
Code:
paul@darkstar:~$ cd /mnt/usbdrive
paul@darkstar:/mnt/usbdrive$ ls -ld
drwxr-xr-x 2 root root 48 2006-04-13 23:18 ./
When I try to mount as a user:
Code:
paul@darkstar:~$ mount /dev/sda1 /mnt/usbdrive
mount: only root can do that
What can I do to allow all users to mount usb drives?
|
|
|
04-16-2006, 01:24 PM
|
#2
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,941
Rep:
|
This should work:
Code:
/dev/sdc1 /mnt/usb vfat noauto,users,rw,umask=1000 0 0
mingdao@silas:~$ mount /mnt/usb && cd /mnt/usb && ls -lh
total 48M
-rwxrwxrwx 1 mingdao users 20M 2006-03-13 12:44 AdbeRdr705_enu_full.exe*
-rwxrwxrwx 1 mingdao users 5.0M 2006-02-08 17:12 Firefox\ Setup\ 1.5.0.1.exe*
-rwxrwxrwx 1 mingdao users 6.1M 2006-03-13 12:41 Thunderbird\ Setup\ 1.5.exe*
-rwxrwxrwx 1 mingdao users 6.7M 2006-03-13 12:43 gaim-1.5.0.exe*
-rwxrwxrwx 1 mingdao users 3.0K 2006-04-12 14:03 invisible.tar.gz*
-rwxrwxrwx 1 mingdao users 65 2006-03-13 13:41 key*
-rwxrwxrwx 1 mingdao users 8.5M 2006-03-13 12:41 nentenst.exe*
-rwxrwxrwx 1 mingdao users 184K 2006-04-12 14:03 slack1.png*
-rwxrwxrwx 1 mingdao users 36 2006-04-04 14:15 ssh*
-rwxrwxrwx 1 mingdao users 1.6M 2006-03-13 12:43 xchat-2.6.1a.exe*
mingdao@silas:/mnt/usb$ cd
mingdao@silas:~$ umount /mnt/usb
mingdao@silas:~$ mount /dev/sdc1 /mnt/usb
mount: only root can do that
mingdao@silas:~$
Just issue "mount /mnt/usbdrive" without the block special device.
|
|
|
04-16-2006, 09:05 PM
|
#3
|
Member
Registered: Feb 2005
Distribution: Mint, Raspbian
Posts: 34
Original Poster
Rep:
|
Thank you, that worked. Now my Camera Download script does the job:
Code:
#!/bin/bash
newdir=`date +%a-%b%d-%Y-%R`
/bin/mkdir /home/paul/images/$newdir
/bin/mount /mnt/usbdrive
/bin/mv /mnt/usbdrive/dcim/100_fuji/* /home/paul/images/$newdir
/bin/umount /mnt/usbdrive
My next project is to figure out how to automatically scale down the images and reduce the filesize a bit.
|
|
|
04-16-2006, 09:14 PM
|
#4
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,941
Rep:
|
Thanks for that script. I'll have to try it with my Sony camera.
Can you tell me what "newdir=`date +%a-%b%d-%Y-%R`" does?
I think to scale the images you can use "convert" or something
else from the imagemagick app.
|
|
|
04-16-2006, 09:33 PM
|
#5
|
Senior Member
Registered: May 2004
Location: Australia
Distribution: Gentoo
Posts: 3,545
Rep:
|
Yup, imagemagick will be able to scale the images for you, awesome app suite that one
|
|
|
04-17-2006, 05:24 AM
|
#6
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,941
Rep:
|
bigwheel,
I gotta learn bash scripting. Got a book or two but never read them.
That's a nice script -- real clean and efficient. I'm going to add
my videos from my Sony camera to it. Thanks!
|
|
|
04-17-2006, 05:44 PM
|
#7
|
Member
Registered: Feb 2005
Distribution: Mint, Raspbian
Posts: 34
Original Poster
Rep:
|
Chinaman probably already figured this out, but
Code:
newdir=`date +%a-%b%d-%Y-%H-%M-%S`
/bin/mkdir /home/paul/images/$newdir
creates a new directory with a name format like
Mon-Apr17-2006-17-36-29
Which is the output of the date function. Look at man date and you can change the format as needed. Warning, don't use a time which has a colon in the output.
This is what I am trying to do to reduce the size of the images after downloading them:
Code:
#!/bin/bash
newdir=`date +%a-%b%d-%Y-%H-%M-%S`
/bin/mkdir /home/paul/images/$newdir
/bin/mount /mnt/usbdrive
/bin/mv /mnt/usbdrive/dcim/100_fuji/* /home/paul/images/$newdir
/bin/umount /mnt/usbdrive
/bin/cd /home/paul/images/$newdir
/usr/bin/gimp -i -b '(gimp-image-scale "*.jpg" 800 600)' '(gimp-quit 0)'
THE LAST TWO LINES DO NOT WORK YET!
I still need to get the gimp command to work on the command line. Actually I have not tested the cd command yet, need some time off to work on it.
Here is where I got the gimp batch script info from:
http://www.gimp.org/tutorials/Basic_Batch/
Last edited by bigwheel; 04-17-2006 at 05:53 PM.
|
|
|
04-17-2006, 05:51 PM
|
#8
|
HCL Maintainer
Registered: Jun 2003
Location: McCalla, AL, USA
Distribution: Arch, Gentoo
Posts: 6,941
Rep:
|
Yes, I issued "man date" just after posting that. And I made me a little script to do my videos, also. I can probably put it in the same script, but haven't yet. When I get some time I'll check out "convert" or something in the Imagemagick app and give you a line to replace that one.
If you get there before me, in a Slackware system we have:
file:///usr/share/doc/ImageMagick-6.2.6/www/convert.html
|
|
|
04-17-2006, 08:56 PM
|
#9
|
Member
Registered: Mar 2006
Location: Fort McMurray, Canada
Distribution: Gentoo ~amd64
Posts: 163
Rep:
|
Get ImageMajick and try this:
Code:
#!/bin/bash
newdir="$(date +%a-%b%d-%Y-%H-%M-%S)"
mkdir $HOME/images/$newdir
cd $HOME/images/$newdir
mount /mnt/usbdrive # this works
mv /mnt/usbdrive/dcim/100_fuji/* ./ # The "./" is NOT a typo
for file in *.jpg # go through every file...
do
convert -size 800x600 $file # ...and resize it
done
umount /mnt/usbdisk # only if you want to
you should have this line in your .bashrc:
Code:
export PATH=/bin:/usr/bin:/usr/local/bin:$HOME/bin:.
this allows you to type cd instead of /bin/cd on the command line or in scripts.
the $(...) on line 2 is equivalent to `...`, but can be quoted safely.
See man strftime for how to format date.
All characters are safe for file or directory names. You just need to escape special ones with a backslash (\).
finally, you can get ImageMajick from imagemajick.org.
Last edited by burninGpi; 04-17-2006 at 08:59 PM.
|
|
|
04-23-2006, 10:55 AM
|
#10
|
Member
Registered: Feb 2005
Distribution: Mint, Raspbian
Posts: 34
Original Poster
Rep:
|
woohoot
I was able to get this script to work:
Code:
#!/bin/bash
mount /mnt/usbdrive # mounts usb device which is defined in fstab:
# /dev/sda1 /mnt/usbdrive vfat noauto,user,rw 0 0
#
newdir="$(date +%a-%b%d-%Y-%H-%M-%S)" # creates date string with format: Mon-Apr17-2006-17-36-29
mkdir $HOME/images/$newdir # makes directory with name = date string
cd $HOME/images/$newdir # change to new directory
mv /mnt/usbdrive/dcim/100_fuji/* ./ # move photo images to new directory, using camera specific path, empties camera
mkdir ./web # create a new directory to put web optimized images
#
for filename in *.jpg # go through every file
do
convert $filename -sample 800x600 -quality 75 web/$filename #resize, compress, save to web directory
done
#
umount /mnt/usbdrive #unmount usb device
It removes images from the camera, puts them in a date/timestamped directory, makes a web directory underneath it, then reduces the size and compresses the images, saving them in the web directory.
Thanks for the help!
Useful links:
http://www.cit.gu.edu.au/~anthony/graphics/imagick6/
http://www.imagemagick.org/script/co...line-tools.php
/usr/doc/ImageMagick-6.2.3
http://linuxcommand.org/learning_the_shell.php
|
|
|
All times are GMT -5. The time now is 08:56 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
|
|