You are not logged in.

#1 2014-03-12 23:17:01

smcsw2000
Member
Registered: 2007-06-22
Posts: 130

usb not writable as user

When using Dolphin in KDE when I plug a usb flash drive in it auto mounts and is readable. When I try to write to it, I get access denied. could not write to /media/usb. I can copy from it and read from it. I used to be able to rread and write to it, but it has been a few months since I tried copying to the usb. The permissions are for root.
I tried chown -R username /media/usb  with no luck.
I tried chmod -R 777 /media/usb and no go.
I tried the line in usb storage wiki for /etc/fstab   /dev/sda1 /media/usb vfat user,noauto,noatime,flush 0 0 and that did not work.
The only thing I can find that I haven't tried is the udev rules, but I am not sure how and which rule to try. Did I miss anything or am I off on something?

Offline

#2 2014-03-12 23:18:39

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,546
Website

Re: usb not writable as user

What is the filesystem on the usb?  If it is ntfs, do you have ntfs-3g installed?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2014-03-13 01:54:25

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: usb not writable as user

Are you sure your pendrive drive is /dev/sda1?

/dev/sda1 /media/usb vfat user,noauto,noatime,flush 0 0

What's the output of 'mount | grep /dev/sd' after you mount that pendrive?

Offline

#4 2014-03-13 03:06:09

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: usb not writable as user

karol wrote:

Are you sure your pendrive drive is /dev/sda1?

/dev/sda1 /media/usb vfat user,noauto,noatime,flush 0 0

What's the output of 'mount | grep /dev/sd' after you mount that pendrive?

... And what is the output of dmesg | tail -20  immediately after you attach the drive to the system?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#5 2014-03-14 02:30:13

smcsw2000
Member
Registered: 2007-06-22
Posts: 130

Re: usb not writable as user

If it is ntfs, do you have ntfs-3g installed?

$ pacman -Q ntfs-3g
ntfs-3g 2014.2.15-1 

What's the output of 'mount | grep /dev/sd' after you mount that pendrive?

$ mount | grep /dev/sd
/dev/sdb3 on / type ext4 (rw,relatime,data=ordered)
/dev/sdb4 on /home type ext4 (rw,relatime,data=ordered)
/dev/sdb1 on /boot type ext2 (rw,relatime)
/dev/sdc3 on /backups type ext3 (rw,relatime,data=ordered)
/dev/sdc1 on /storage type ext3 (rw,relatime,data=ordered)
/dev/sdc2 on /pictures type ext3 (rw,relatime,data=ordered)
/dev/sdh1 on /media/usb type vfat (rw,nosuid,nodev,noexec,noatime,fmask=0022,dmask=0022,codepage=437,iocharset=iso8859-1,shortname=mixed,flush,errors=remount-ro,user)

rechecking /etc/fstab I find I did a typo this is the fstab

/dev/sdh1		/media/usb  vfat    user,noauto,noatime,flush	   0	  0

what is the output of dmesg | tail -20  immediately after you attach the drive to the system?

$ dmesg | tail -20
[37990.624558] fuse init (API version 7.22)
[43243.442094] r8169 0000:03:00.0 eth0: link down
[43246.751162] r8169 0000:03:00.0 eth0: link up
[43251.440460] r8169 0000:03:00.0 eth0: link down
[43281.271548] r8169 0000:03:00.0 eth0: link up
[93493.274201] usb 1-2: new high-speed USB device number 3 using ehci-pci
[93493.408677] usb-storage 1-2:1.0: USB Mass Storage device detected
[93493.408890] scsi5 : usb-storage 1-2:1.0
[93494.412313] scsi 5:0:0:0: Direct-Access     Kingston DataTraveler 2.0 PMAP PQ: 0 ANSI: 0 CCS
[93494.988986] sd 5:0:0:0: [sdh] 3919872 512-byte logical blocks: (2.00 GB/1.86 GiB)
[93494.989728] sd 5:0:0:0: [sdh] Write Protect is off
[93494.989740] sd 5:0:0:0: [sdh] Mode Sense: 23 00 00 00
[93494.990475] sd 5:0:0:0: [sdh] No Caching mode page found
[93494.990486] sd 5:0:0:0: [sdh] Assuming drive cache: write through
[93494.994477] sd 5:0:0:0: [sdh] No Caching mode page found
[93494.994487] sd 5:0:0:0: [sdh] Assuming drive cache: write through
[93494.995112]  sdh: sdh1
[93494.998589] sd 5:0:0:0: [sdh] No Caching mode page found
[93494.998595] sd 5:0:0:0: [sdh] Assuming drive cache: write through
[93494.998604] sd 5:0:0:0: [sdh] Attached SCSI removable disk

Offline

#6 2014-03-14 02:58:00

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,722

Re: usb not writable as user

So, where are we at?  The drive is enumerated as /dev/sdh.  It has a partition /dev/sdh1 that is mounting at /media/usb and is read/write. 
Is this working yet?  Can root write?  If not we need to look at the umask. 

man mount wrote:

Mount options for ntfs
       iocharset=name
              Character set to use when returning file  names.   Unlike  VFAT,
              NTFS  suppresses  names  that contain nonconvertible characters.
              Deprecated.

       nls=name
              New name for the option earlier called iocharset.

       utf8   Use UTF-8 for converting file names.

       uni_xlate={0|1|2}
              For 0 (or `no' or `false'), do  not  use  escape  sequences  for
              unknown  Unicode  characters.   For 1 (or `yes' or `true') or 2,
              use vfat-style 4-byte escape sequences starting with ":". Here 2
              give  a  little-endian  encoding  and  1 a byteswapped bigendian
              encoding.

       posix=[0|1]
              If enabled (posix=1), the filesystem distinguishes between upper
              and  lower case. The 8.3 alias names are presented as hard links
              instead of being suppressed. This option is obsolete.

       uid=value, gid=value and umask=value
              Set the file permission on the filesystem.  The umask  value  is
              given in octal.  By default, the files are owned by root and not
              readable by somebody else.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#7 2014-03-14 22:23:02

smcsw2000
Member
Registered: 2007-06-22
Posts: 130

Re: usb not writable as user

using Dolphin in KDE I cen read and copy from the usb but cannot write.
using terminal as user I can read and copy from the usb but cannot write.
using terminal as root I can read, write copy to and from the usb and delete.

Offline

#8 2014-03-14 22:54:46

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: usb not writable as user

What do you mean by 'cannot write'? What error do you get?

Offline

#9 2014-03-15 23:48:40

smcsw2000
Member
Registered: 2007-06-22
Posts: 130

Re: usb not writable as user

When I try to copy files in KDE Dolphin i get   

Access Denied. Could not write to '/media/usb'

When I try writing in terminal as non root user I get 

 cp: cannot create regular file ‘/media/usb/katie.jpeg’: Permission denied

Offline

#10 2014-03-16 04:13:27

alexftw
Member
Registered: 2013-07-03
Posts: 15

Re: usb not writable as user

I get a similar error with a vfat partition.

rm: remove write-protected regular file 'testfile'? y
rm: cannot remove 'testfile': Permission denied

partition in /etc/fstab:

/dev/sda2		/media/shared		vfat		auto,user,exec,rw,async		0 0

Root can read/write, users can only read.

Offline

#11 2014-03-16 04:30:18

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: usb not writable as user

@smcsw2000
What's the output of

ls -l /media/usb

@alexftw
What's the output of

ls -l /media/shared

Offline

#12 2014-03-16 04:34:26

alexftw
Member
Registered: 2013-07-03
Posts: 15

Re: usb not writable as user

karol wrote:

What's the output of

ls -l /media/shared
[alexander@alexander-p6634 ~]$ LANG=C ls -l /media/shared/
total 649536
drwxr-xr-x  3 root root     32768 Feb 15 21:39 $RECYCLE.BIN
drwxr-xr-x 17 root root     32768 Mar 15 23:10 Bilder
drwxr-xr-x  7 root root     32768 Mar 13 22:11 Desktop
drwxr-xr-x  5 root root     32768 Mar 13 22:06 Dokumente
drwxr-xr-x 23 root root     32768 Mar 16 05:32 Downloads
drwxr-xr-x 13 root root     32768 Mar 16 05:32 Meine Dateien
drwxr-xr-x 48 root root     32768 Mar 16 05:32 Musik
drwxr-xr-x  3 root root     32768 Feb 16 04:30 SB3_CEE-EN
-rwxr-xr-x  1 root root      9667 Mar  1 15:42 Save01.lsd
drwxr-xr-x  3 root root     32768 Mar 13 22:20 Scripts
-rwxr-xr-x  1 root root 610701712 Mar  9 20:53 V20B_00.kdz
drwxr-xr-x  5 root root     32768 Feb 22 17:38 Videos
drwxr-xr-x 11 root root     32768 Mar 13 22:12 ardourprojects
-rwxr-xr-x  1 root root     10961 Feb 22 17:35 bookmarks-2014-02-22.json
-rwxr-xr-x  1 root root     12729 Mar 13 22:01 bookmarks-2014-03-13.json
-rwxr-xr-x  1 root root   3852114 Mar  9 20:58 kdz-update.rar
-rwxr-xr-x  1 root root        58 Mar  9 21:00 link.txt
-rwxr-xr-x  1 root root    904704 Dec  1  2006 msdia80.dll
-rwxr-xr-x  1 root root       438 Feb 20 18:32 taiyou_todo
-rwxr-xr-x  1 root root       439 Feb 15 15:34 taiyou_todo~
drwxr-xr-x  2 root root     32768 Mar  2 19:58 wineprefixes
-rwxr-xr-x  1 root root  48997066 Apr  3  2008 yumenikki0.10eng.exe

Last edited by alexftw (2014-03-16 11:52:53)

Offline

#13 2014-03-16 04:38:00

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: usb not writable as user

And the output of

ls -l /media

Offline

#14 2014-03-16 04:39:34

alexftw
Member
Registered: 2013-07-03
Posts: 15

Re: usb not writable as user

total 32
drwxr-xr-x 17 root root 32768 Mar 16 05:32 shared

EDIT: Just found out the solution. Source: fstab - ArchWiki

/dev/sda2		/media/shared	vfat		user,rw,umask=111,dmask=000	0 0

Last edited by alexftw (2014-03-17 21:48:16)

Offline

#15 2014-03-16 22:59:43

smcsw2000
Member
Registered: 2007-06-22
Posts: 130

Re: usb not writable as user

the ouplut of ls -l /media/usb

 $ ls -l /media/usb
total 20768
-rwxr-xr-x 1 root root   92905 Mar 13  2010 036-sunset-and-waves.jpg
-rwxr-xr-x 1 root root   62144 Mar 12  2010 1_fish.jpg
-rwxr-xr-x 1 root root   89810 Mar 13  2010 7933-flowers-angostura-argentina.jpg
-rwxr-xr-x 1 root root    8887 Sep 14  2006 american eagle.gif
-rwxr-xr-x 1 root root  135747 Nov 21  2003 andy and linda1.jpg
-rwxr-xr-x 1 root root   45697 Mar 13  2010 AscdaHawaiianMonarch2.jpg
-rwxr-xr-x 1 root root   43645 Mar 13  2010 AscdaHawaiianMonarch.jpg
-rwxr-xr-x 1 root root   66878 Mar 15  2010 beautiful_flower205b.jpg
-rwxr-xr-x 1 root root   67413 Mar 15  2010 beautiful_flower205p.jpg
-rwxr-xr-x 1 root root   50869 Mar 13  2010 birdofparadise.jpg
-rwxr-xr-x 1 root root  135757 Mar 14  2010 cymbidium-orchid-wallpaper.jpg
-rwxr-xr-x 1 root root   23335 Mar 13  2010 dancing orchids.jpg
-rwxr-xr-x 1 root root  120998 Mar 14  2010 flower_photos08.jpg
-rwxr-xr-x 1 root root   57295 Mar 13  2010 flowers_067yellow rose.jpg
-rwxr-xr-x 1 root root   79618 Mar 13  2010 flowers_077.jpg
-rwxr-xr-x 1 root root   48514 Mar 15  2010 flower_wreath horse.jpg
-rwxr-xr-x 1 root root   26855 Mar 12  2010 fushia plant.jpg
-rwxr-xr-x 1 root root   98850 Mar 13  2010 HawaiianFlowers43.jpg
-rwxr-xr-x 1 root root   55352 Mar 13  2010 hawaiianhybiscus.jpg
-rwxr-xr-x 1 root root  149434 Mar 13  2010 Hawaiian-Marriage-Blessing.jpg
-rwxr-xr-x 1 root root   95468 Mar 13  2010 Hawaiian_Plumeria2.jpg
-rwxr-xr-x 1 root root 2087071 Dec 28  2008 Katie in her china dress.JPG
-rwxr-xr-x 1 root root  175127 Mar 14  2010 lilac4.jpg
-rwxr-xr-x 1 root root   54771 Mar 15  2010 NatureInLove08.jpg
 

tried alexftw solution with fstab by inserting in fstab

 /dev/sdh1		/media/usb  vfat    user,rw,umask=022,dmask=000	   0	  0 

and still have the same problem, nothing changed

Offline

Board footer

Powered by FluxBB