NAS Server Configuration
Steps
1. Install Kali
UEFI boot mode is recommended; otherwise there is a chance that after installation you end up stuck on a black screen with a _ blinking in the top-left corner when booting. That means the boot is broken, and the cause is unknown. Anyway, switch to UEFI boot in the BIOS and then install it again, and you will be able to enter the system.
2. Pre-process the Hard Drive
If you are using an old hard drive, consider deleting the partitions and then creating new partitions formatted as the ext4 file system as needed. If you run into problems with the steps below, try rebooting to refresh the file system.
View partitions
1sudo fdisk -lHere, for example,
sda,sdbrepresent whole hard drives, whilesda1,sda2are the different partitions on the drivesda.Delete partitions (be careful with deletion operations)
Be extremely careful. My hand slipped in the past two days, and I deleted the
/etcon the server and the/devon the NAS…Delete the specified partition:
1sudo fdisk /dev/sdb # 要删分区的硬盘。Then type
mto view the help,dto delete; you will need to select the partition number. If you want to delete all the partitions of a whole hard drive, just delete them one by one with the defaults; you can also directly format the whole hard drive, see below for the steps. After deleting, remember to typewto save, otherwise the partitions will not be deleted.Create new partitions
The same partition operation commands:
1sudo fdisk /dev/sdbType
nto create a new partition, typepto create a primary partition, enter the partition number, and the following steps determine the partition start position and partition size. If you have no special needs, just accept all defaults and make one partition over the whole hard drive.When done, remember to type
wto save as well.Format partitions (be careful with deletion operations)
The command to format the specified partition is as follows:
1sudo mkfs.ext4 /dev/sdb1The command to format the whole hard drive:
1sudo mkfs.ext4 /dev/sdbIt will ask for confirmation; don’t let your hand slip.
3. Mount the Hard Drive
Create a new mount point
1mkdir -p /mnt/HDD_1Temporary mount; canceled at shutdown
1mount /dev/sdb1 /mnt/HDD_1Unmount a partition
1umount /dev/sdb1Configure auto-mount at boot
First view the
UUIDof the partition:1sudo blkidThe output is as follows:
1/dev/sdb1: UUID="11263962-9715-473f-9421-0b604e895aaa" TYPE="ext4"Configure auto-mount:
1nano /etc/fstabAdd a line:
1UUID=11263962-9715-473f-9421-0b604e895aaa /mnt/HDD_1 ext4 defaults 0 01 2 3 4 5 6 7 8 9<fs spec> <fs file> <fs vfstype> <fs mntops> <fs freq> <fs passno> 具体说明,以挂载/dev/sdb1为例: <fs spec>: 分区定位,可以给UUID或LABEL,例如:UUID=6E9ADAC29ADA85CD或LABEL=software <fs file>: 具体挂载点的位置,例如:/mnt/HDD_1 <fs vfstype>:挂载磁盘类型,linux分区一般为ext4,windows分区一般为ntfs <fs mntops>: 挂载参数,一般为defaults <fs freq>: 磁盘检查,默认为0 <fs passno>: 磁盘检查,默认为0,不需要检查Test the mount and see whether all the partitions have been successfully mounted.
1sudo mount -aIf there is a problem and you have rebooted, it may cause the system partition to fail to auto-mount and the system to fail to boot; the solution is to enter recovery mode and modify
/etc/fstab.
4. Enable Samba
Before this, if you are not using the root user, other users will only have read-only permissions later, so depending on your needs, consider giving all users read, write and execute permissions:
| |
Install Samba
1sudo apt install sambaConfigure Samba
1nano /etc/samba/smb.confIf the default configuration is not needed, you can delete it all; configure it as follows:
1 2 3 4 5[HDD_1] # 展示的共享名 path = /mnt/3TB_HDD_1 # 共享路径 browseable = yes # 允许浏览 writeable = yes # 允许写入 read only = no # 关闭只读Add an SMB account
1sudo smbpasswd -a <用户名> # 必须是系统中存在的用户名,譬如当前用户名。Start the smb service
1 2sudo systemctl restart smbd.service sudo systemctl restart nmbd.serviceEnable auto-start at boot
1 2sudo systemctl enable smbd.service sudo systemctl enable nmbd.service
Done. Now you can connect to the NAS over SMB and enjoy life.