DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD General

OpenBSD General Other questions regarding OpenBSD which do not fit in any of the categories below.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 29th April 2016
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 283
Default No write permission on USB devices.

With my previous installation I followed this guide, http://daemonforums.org/showthread.p...nt+normal+user, to enabled mounting USB devices and it worked perfectly. This time I followed the same steps, but it is not working completely. I can mount devices, read them and copy files from them, but I do not have write privileges, even when logged in as root.

Code:
$ sysctl -a | grep mount   
kern.usermount=1
Code:
$ groupinfo operator
name    operator
passwd  *
gid     5
members root randicus
kern.usermount is set to allow non-root users to mount devices.
My user is a member of the operator group.
Yet, when attempting to write to devices:
Code:
Permission denied (13)
Has something changed with the system since the guide was written? The only thing I noticed was that /etc/sysctl.conf did not exist until I created it, but the file is working, as the grep command shows. Or am I missing something and succeeded last time out of sheer luck?
Reply With Quote
  #2   (View Single Post)  
Old 29th April 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

I'll guess: you missed step 1.6.

Look at the permissions of the device special file.
Reply With Quote
  #3   (View Single Post)  
Old 29th April 2016
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 283
Default

No, I did that. (As far as I know, I did exactly the same thing as last time.)
Checking permissions as both sd1i and sd1i usb are:
Code:
$ ls -l /dev/sd1i
brw-r-----  1 root  operator    4,  24 Apr 26 08:37 /dev/sd1i
Code:
$ ls -l /dev/sd1i usb
brw-r-----  1 root  operator    4,  24 Apr 26 08:37 /dev/sd1i

usb:
total 50112
-rwxr-xr-x  1 root  randicus    572030 Mar 14 20:19 3_282.jpg
-rwxr-xr-x  1 root  randicus    918793 Mar 13 18:50 654d0a1b16ef.gif
drwxr-xr-x  1 root  randicus     16384 Apr 25 18:45 Anglo-Saxon
drwxr-xr-x  1 root  randicus     16384 Sep 17  2014 Back-up
. . .
Reply With Quote
  #4   (View Single Post)  
Old 29th April 2016
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 283
Default

I just tried something that did not work before, but works now. I can now write to the device as root, but not as regular user.
Reply With Quote
  #5   (View Single Post)  
Old 29th April 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Let's look at the requirements for usermount, rather than blindly guessing. Look at the mount(8) man page, which lists three requirements. All three must be satisfied.
Quote:
Only the superuser may mount file systems unless kern.usermount is nonzero (see sysctl(8)), the special device is readable and writeable by the user attempting the mount, and the mount point node is owned by the user attempting the mount.
1. sysctl

You have set this.

2. device special file

The access rights are not set according to the man page.
  • owner: root, access rights: read/write
  • group: operator, access rights: read-only
  • world: access rights: none

3. Ownership of mount point

You have not shared this information, but this is also a requirement.
Reply With Quote
  #6   (View Single Post)  
Old 30th April 2016
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 283
Default

Strange.
The other day I tried to create a mount point under /mnt as per section 1.8 in the guide before creating a ~/home/usb, but an error message was generated. I forget what it was, but I then went the /usb route. I must have made a very small typo that I was too tired to see. I tried it again today and it worked. I now have a mount point in /mnt and write permission to devices mounted there.

Quote:
3. Ownership of mount point

You have not shared this information, but this is also a requirement.
Code:
$ ls -l /dev/sd1i usb
brw-r-----  1 root  operator
No device is mounted, so I assume the Is command is listing the ownership of /usb. The output appears to be the same as in the guide, but I am rather inept at computers, so I may be easily misinterpreting things.

I am not that worried though. Since /mnt is now working properly, I have confusion but no problem using devices.
Reply With Quote
  #7   (View Single Post)  
Old 30th April 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Quote:
No device is mounted, so I assume the Is command is listing the ownership of /usb.
No, that is the ownership of the device node.
Reply With Quote
  #8   (View Single Post)  
Old 30th April 2016
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 283
Default

I was following the logic that ownership of a node would extend to whatever is mounted on it. (Saying I am not computer savvy is a gross understatement.)
Reply With Quote
  #9   (View Single Post)  
Old 30th April 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

If you are mounting a FAT (MS-DOS) filesystem, there is no concept of owner/group and related access authorizations. Your mount(8) will call mount_msdos(8) -- its man page discusses how owner/group and access permissions are set or overridden at mount time. After all of the override options, comes this, highlight mine:
Quote:
...File permissions for FAT file systems are imitated, since the file system has no real concept of permissions. The default mask is taken from the directory on which the file system is being mounted, except when the -m option is used. FAT does have a “read only” mode, in which the writable bit is unset. If such files are found, they are marked non-writable...

Last edited by jggimi; 30th April 2016 at 01:22 PM. Reason: clarity
Reply With Quote
Old 30th April 2016
jjstorm jjstorm is offline
Package Pilot
 
Join Date: Nov 2014
Location: Buenos Aires, AR
Posts: 144
Default

I personally prefer to use DOAS

I created an /etc/doas.conf file and added permissions for regular users. For more info take a look at DOAS.CONF(5)

example:

Code:
permit nopass user as root cmd mount
permit nopass user as root cmd umount
then just use chown(8) to change file owner and group accordingly.

DOAS is much simpler and accomplishes the same thing with no headaches.
Reply With Quote
Old 30th April 2016
hanzer's Avatar
hanzer hanzer is offline
Real Name: Adam Jensen
just passing through
 
Join Date: Oct 2013
Location: EST USA
Posts: 314
Default

If I understood your situation correctly, then this might accomplish your goals:

$ doas chmod g=rw /dev/sd1i (This only needs to be done once).

Then mount the drive:

$ mount_msdos -o rw,nosuid,nodev /dev/sd1i ~/usb

When you are finished accessing the drive:

$ umount ~/usb

The next time you plug in the drive, repeat the mount_msdos command.
Reply With Quote
Old 30th April 2016
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 283
Default

DOAS is something to consider in the future. For now I was just puzzled why the procedure in that one part of jggimi's guide worked flawlessly last time, but had that small problem this time. The smartest thing I can do is assume I screwed up something somewhere. I gave up trying to get printers working on OpenBSD, because it is too difficult for my non-computer mind, so PEBCAK is a regular occurrence for me. I have no idea what I could have messed up following such a clear and easy guide, but with me anything is possible.
Reply With Quote
Old 30th April 2016
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 7,983
Default

Quote:
Originally Posted by sacerdos_daemonis View Post
...jggimi's guide...
No, it was written by J65nko.
Reply With Quote
Old 1st May 2016
sacerdos_daemonis's Avatar
sacerdos_daemonis sacerdos_daemonis is offline
Real Name: Will forever be a secret.
Spam Deminer
 
Join Date: Sep 2014
Posts: 283
Default

Oops. Careless typing. My apologies to J65nko.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
write file into usb - operation not supported threaderslash OpenBSD General 8 2nd September 2011 04:57 PM
/tmp on ram write denied gosha OpenBSD General 8 29th March 2009 04:46 PM
Why you should write a guide/howto in XML J65nko Guides 4 19th October 2008 07:46 PM
[F1] write usb modem driver raixun Programming 7 17th July 2008 11:06 AM
[VSFTPD] Can't write in directory Sunsawe General software and network 7 1st June 2008 11:29 PM


All times are GMT. The time now is 07:12 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick