1. Migrating /home partition to 3TB external HDD
2. Configuring samba
3. Adding user and share
1. Migrating /home partition to 3TB external HDD:
I'm using this URL as a guidance, but I re-write this as simple as I have done:
a. Check the UUID of external HDD
$ sudo blkidb. Backup /etc/fstab
$ sudo cp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)c. Compare the two fstab files
$ cmp /etc/fstab /etc/fstab.$(date +%Y-%m-%d)d. Edit original /etc/fstab
# (identifier) (location) (format) (some settings)replace the ??? in UUID with the one you've got from blkid command for your HDD
UUID=??? /mnt/home ext3 defaults 0 2
e. Create the mount folder
$ sudo mkdir /mnt/homef. Reload the updated /etc/fstab
$ sudo mount -ag. Copy existing /home to new partition
$ sudo rscync -aXS --exclude='/*/.gvfs' /home/. /mnt/home/h. Confirm that all files and folders are copied successfully
$ sudo diff -r /home /mnt/homei. Edit /etc/fstab, preparing for switch
# (identifier) (location) (format) (some settings)j. Moving /home to /old_home
UUID=??? /home ext3 defaults 0 2
$ cd / && sudo mv /home /old_home && sudo mkdir /homek. Reload the updated /etc/fstab
$ sudo mount -a2. Configuring Samba:
a. Edit /etc/samba/smb.conf
security = userb. Restart Samba service
[share]
path = /home
browseable = yes
writable = yes
public = yes
guest ok = yes
$ service smb restart3. Adding User and share:
$ service nmb restart
a. Add samba user without UNIX login:
$ useradd -s /sbin/nologin [username]b. Set samba password for new user:
$ smbpasswd -a [username]c. Put the new user in the user group:
$ usermod -a -G [username] [usergroup] (e.g. usermod -a -G andy andy)d. Set priviledge to certain folder only available to certain user/group:
$ chmod 775 /home/[username]
You can check that there will be new folder created under /home with username you create. Using this command:
$ ls -lart /homeYou can see that each of that folder own by username, this way when another username access the samba share, they can see another user folder, but don't have the priviledge to access them. This config already tested in my office with many users using different OS (Windows, Mac, Linux).
I am curious to find out what blog system you are using? Im having some small security problems with my latest website and Id like to find something more risk-free. Do you have any suggestions? Hmm it looks like your blog ate my first comment (it was super long) so I guess Ill just sum it up what I wrote and say, Im thoroughly enjoying your blog. I too am an aspiring blog blogger but Im still new to everything. Do you have any tips and hints for rookie blog writers? Id definitely appreciate it.
ReplyDelete