You are not logged in.

#1 2017-01-22 21:10:37

marcelo1401
Member
Registered: 2016-11-06
Posts: 22

[SOLVED]Getting write access to a fat32 usb drive/ changing the owner

Hello,

I'm having trouble with getting  write permissions on a fat32 formatted drive. I used this command to format it: sudo mkfs.vfat /dev/sdb1 -F32 -n Sandisk. I also tried replacing /dev/sdb1 for /dev/sdb but ended up with the same result. When I try to access the drive it sets the owner to root and I cannot do anything as a regular user.

Thanks in advance.

Last edited by marcelo1401 (2017-01-25 17:13:59)

Offline

#2 2017-01-22 21:17:29

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED]Getting write access to a fat32 usb drive/ changing the owner

How do you mount the drive?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-01-22 21:29:12

marcelo1401
Member
Registered: 2016-11-06
Posts: 22

Re: [SOLVED]Getting write access to a fat32 usb drive/ changing the owner

jasonwryan wrote:

How do you mount the drive?

I use

sudo mount /dev/sdb1 USB

; I also tried

mount /dev/sdb1 USB

Offline

#4 2017-01-22 21:58:51

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,740

Re: [SOLVED]Getting write access to a fat32 usb drive/ changing the owner

Quoth 'man mount'

   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.

Mayhaps an appropriate set of uid, gid, and umask will solve your problem?


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2017-01-22 22:08:43

loqs
Member
Registered: 2014-03-06
Posts: 17,196

Re: [SOLVED]Getting write access to a fat32 usb drive/ changing the owner

The option names are the same for ntfs and fat and the values by default are the same as the mount command is being run by root.

Offline

#6 2017-01-25 15:51:27

marcelo1401
Member
Registered: 2016-11-06
Posts: 22

Re: [SOLVED]Getting write access to a fat32 usb drive/ changing the owner

Sorry I haven't answered sooner.

ewaller wrote:

Mayhaps an appropriate set of uid, gid, and umask will solve your problem?

How would I set those value, what would be the comand? I tried

 sudo mount /dev/sdb1 USB -o umask=750

and can't get it working consistently, sometimes it does sometimes it doesn't.

Offline

#7 2017-01-25 16:55:11

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,740

Re: [SOLVED]Getting write access to a fat32 usb drive/ changing the owner

I usually set dmask and fmask, but I think setting just umask should do it.  The mask is in octal, so I think you need a leading 0 (zero).   IOW, umask=0750
I could be wrong, and (unfortunately) I cannot fiddle with my Linux box right now.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#8 2017-01-25 17:13:16

marcelo1401
Member
Registered: 2016-11-06
Posts: 22

Re: [SOLVED]Getting write access to a fat32 usb drive/ changing the owner

Thanks ewaller. That's it! big_smile Btw, if you want to mount the drive with your user as the owner you'll have to set uid and gid too. This is the comand I used

 sudo mount /dev/sdb1 USB/ -o uid=1000,gid=1000,umask=0750 

You may have to tweak it to your own system.

Last edited by marcelo1401 (2017-01-25 17:23:33)

Offline

Board footer

Powered by FluxBB