Using old netbook as NAS and mpd server
Table of Contents
- 1. Turn on the netbook
- 2. Install and enable ssh
- 3. Setup the hostname
- 4. Install Samba
- 5. Grant Samba write permission to the file system
- 6. Enable and start smb services
- 7. Setting permissions of the share directory.
- 8. Samba configurations
- 9. Mounting external drive, well it is easy :)
- 10. Conclusion
I have ASUS netbook eeePC 1005PX and it is one of my favourite possession. I bought it in 2010 and used it heavily till 2015 or 2016. I used to carry it with me everywhere, to my client meetings, to cafes and it was my secondary work machine for doing proper work. I had Windows installed in it but later switched to fedora with xfce desktop. It is not at all fast but gets the work done. I was not using it for a long time, I didn try to use it for some side projects but didn't do much with it.
I had Raspberry pi in India, I bought it when it came out and used it as a network storage and also as an mpd server. Although I do use Amazon Music, Spotify and YouTube for listening to music once in a while but I was missing my own mpd server. After moving to UK I never really got a chance to set it up. Today is the day.
1 Turn on the netbook
Yeah it turned it on. I had the Indian plug but I found a UK plug which I connected to the power adaptator and all good.
2 Install and enable ssh
dnf install openssh-server
Check the status of sshd.
systemctl status sshd
If it is not running then run it.
systemctl start sshd
I already have openssh-server
installed so I just had to run the service and make sure it starts on boot.
systemctl enable sshd
3 Setup the hostname
It is good to have a hostname of the machine.
hostnamectl set-hostname ravi-netbook hostnamectl status
4 Install Samba
dnf install samba
5 Grant Samba write permission to the file system
We have to modify few things in fedora SELinux.
setsebool -P smbd_anon_write=1
Verify that it has been set correctly.
getsebool smbd_anon_write
You will see an output like this.
smbd_anon_write --> on
If you don't use SELinux then just disable it completely.
setenforce 0
6 Enable and start smb services
systemctl enable smb.service systemctl start smb.service
7 Setting permissions of the share directory.
It is not good to set 777 as the permission but I was in hurry and I will come back to fix the permissions when everything is working fine.
sudo chmod 777 /srv/public
Time to change the ownership of this directory.
sudo chown ravisagar:ravisagar -R /srv/public
8 Samba configurations
Add this in your /etc/samba/smb.conf
file and restart smb.
[global] [public] path = /srv/public comment = Public Folder read only = No public = yes writable = yes write list = samba create mask = 0777 directory mask = 0777
Again, please make sure the permissions work for you.
9 Mounting external drive, well it is easy :)
Check connected drives.
lsblk
Then mount it to a folder that you can create in your /srv/public
directory.
sudo mount /dev/sdb1 /srv/public/backup1_2tb/
Mount with specific user's permission using mask
sudo mount -o umask=0022,gid=1000,uid=1000 /dev/sdb1 /srv/public/backup1_2tb
You can check your id using id
command.
Mount using the UUID. First find the UUID of connected devices.
sudo blkid
Un mount previously mounted drive.
sudo umount /srv/public/backup1_2tb
Then mount using the UUID.
sudo mount UUID=ADFC5DDFFC5CF68DF /srv/public/backup1_2tb/
Now make sure this drive is mounted on reboot. So add this in your /etc/fstab
UUID=ADFC5DDFFC5CF68D /srv/public/backup1_2tb auto defaults 0 2
Reboot your computer and test if the drive is mounted.
sudo shutdown -r 0
Mounting second external drive.
I had to install fuse-exfat
before mounting my second hard disk.
sudo dnf -y install exfat
10 Conclusion
So I hope you enjoyed reading this blog. It is not very proper setup but suitable for home I guess :)
That is it. Enjoy.
Having a samba share has multiple benefits. You have storage which is always accessible, also I use this storage's path in my mpd configuration. I wrote about how to configure mpd and ncmpcpp where I explain how to setup a server and client. In the configuration of mpd you have to specify the location of the songs. It could be local or a remote.
On mac when you add a network storage it is added at /Volumes/public
.