In the USB storage section:
Describe how to make USB devices mountable as a normal user. PR: docs/106148 Submitted by: Roland Smith <rsmith@xs4all.nl> With some help from: ceri@
This commit is contained in:
parent
73210a7569
commit
dc1f80fd35
Notes:
svn2git
2020-12-08 03:00:23 +00:00
svn path=/head/; revision=29204
1 changed files with 57 additions and 0 deletions
|
|
@ -809,6 +809,63 @@ da0: 126MB (258048 512 byte sectors: 64H 32S/T 126C)</screen>
|
|||
to format and create partitions on the USB drive if
|
||||
needed.</para>
|
||||
|
||||
<para>To make this device mountable as a normal user, certain
|
||||
steps have to be taken. First, the devices that are created
|
||||
when a USB storage device is connected need to be accessible
|
||||
by the user. A solution is to make all users of these devices
|
||||
a member of the <groupname>operator</groupname> group. This
|
||||
is done with &man.pw.8;. Second, when the devices are
|
||||
created, the <groupname>operator</groupname> group should be
|
||||
able to read and write them. This is accomplished by adding a
|
||||
line for these devices to
|
||||
<filename>/etc/devfs.rules</filename>:</para>
|
||||
|
||||
<programlisting>add path 'da*' mode 0660 group operator</programlisting>
|
||||
|
||||
<note>
|
||||
<para>If there already are SCSI disks in the system, it must
|
||||
be done a bit different. E.g., if the system already
|
||||
contains disks <devicename>da0</devicename> through
|
||||
<devicename>da2</devicename> attached to the system, change
|
||||
the line as follows:</para>
|
||||
|
||||
<programlisting>add path 'da[3-9]*' mode 0660 group operator</programlisting>
|
||||
|
||||
<para>This will exclude the already existing disks from
|
||||
belonging to the <groupname>operator</groupname>
|
||||
group.</para>
|
||||
</note>
|
||||
|
||||
<para>Next, the kernel has to be configured to allow regular
|
||||
users to mount file systems. The easiest way is to add the
|
||||
following line to
|
||||
<filename>/etc/sysctl.conf</filename>:</para>
|
||||
|
||||
<programlisting>vfs.usermount="1"</programlisting>
|
||||
|
||||
<para>Note that this only takes effect after the next reboot.
|
||||
Alternatively, one can also use &man.sysctl.8; to set this
|
||||
variable.</para>
|
||||
|
||||
<para>The final step is to create a directory where the file
|
||||
system is to be mounted. This directory needs to be owned by
|
||||
the user that is to mount the file system. One way to do that
|
||||
is for <username>root</username> to create a subdirectory
|
||||
owned by that user as
|
||||
<filename>/mnt/<replaceable>$USER</replaceable></filename>
|
||||
(replace <replaceable>$USER</replaceable> by the login name of
|
||||
the actual user):</para>
|
||||
|
||||
<screen>&prompt.root; <userinput>mkdir /mnt/$USER</userinput>
|
||||
&prompt.root; <userinput>chown <replaceable>$USER</replaceable>:<replaceable>$USER</replaceable> /mnt/<replaceable>$USER</replaceable></userinput></screen>
|
||||
|
||||
<para>Suppose a USB thumbdrive is plugged in, and a device
|
||||
<filename>/dev/da0s1</filename> appears. Since these devices
|
||||
usually come preformatted with a FAT file system, one can
|
||||
mount them like this:</para>
|
||||
|
||||
<screen>&prompt.user; <userinput>mount_msdosfs -m 644 -M 755 /dev/da0s1 /mnt/<replaceable>$USER</replaceable></userinput></screen>
|
||||
|
||||
<para>If you unplug the device (the disk must be unmounted
|
||||
before), you should see, in the system message buffer,
|
||||
something like the following:</para>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue