NFS server on OpenBSD
Note: if having trouble with the vi text editor, I listed a few simple commands elsewhere on the blog. For now, a few quick reminders:
i --> enters Insert mode (where you can enter text)
[ESC] --> enters command mode
:w --> saves the file (have to be in command mode)
:q --> exits the file (have to be in command mode)
useradd -b /home/faculty/ -s /bin/bash -m admin
passwd admin
Let's use the passwordPassword!
since this is a local machine, and I'm assuming that the folks on the LAN are friendly.Next, make sure the new user owns their home directory.
chown -R admin: admin
And then create the shared directory inside /home/admin,mkdir /home/admin/storage
and make sure that everyone can read/write to that spot.chmod -R 777 /home/admin/storage
I think nfs can be activated by adding the following to rc.conf.local. (src; might not be updated, and I can't see more than the first bit)vi /etc/rc.conf.local
add to the end of the file:portmap=YES
nfs_server=YES
OR, I can run these two commands. There's this thing about multiple server instances, so that I can handle concurrent requests, that I can control with the following commands...I just don't know if the services will be enabled after a reboot.rcctl enable portmap mountd nfsd
rcctl set nfsd flags -tun 4
Once the services are started, the /etc/exports file needs an entry. This is how the machine knows to share the folder - and who to share it to.vi /etc/exports
add to the bottom (this gives everyone accessing the folder root access),/home/admin/storage -alldirs -mapall=root
Now the nfs service can be startedrcctl start portmap mountd nfsd
and in case you edited the /etc/exports file while the NFS was running, restart the service.rcctl reload mountd
Mount
to mount the new network folder, you have to create your own location for the folder to present itself, and then set the folder to automount.
Also, don't forget to install the nfs software. It came default on OpenBSD, but not so much on Linux Mint.
sudo apt-get install nfs-server -y
create /storage in the root directory
sudo mkdir /storage
give everyone all permissions
chmod 777 /storage
edit the fstab to automount the folder - we'll assume the hostname of the OpenBSD server is 'server1'
sudo nano /etc/fstab
and add this to the bottom of the file
server1:/home/admin/storage /storage nfs
and remount everythingsudo mount -a
that's it! You should have full access to the network folder.