Open ericvlog opened 2 years ago
The first step in setting up SAMBA is to install the necessary packages. This can be done using Debian's package management system. Open a terminal and run the following command:
sudo apt update
sudo apt install samba samba-common-bin
Once the installation process completes, the SAMBA service should start automatically. You can verify its status with:
sudo systemctl status smbd
With SAMBA installed, the next step is to configure it appropriately. The main configuration file for SAMBA is /etc/samba/smb.conf
. Before making changes, it's good practice to back up the original configuration file:
sudo cp /etc/samba/smb.conf /etc/samba/smb.conf.backup
Edit the configuration file using your preferred text editor, like nano:
sudo nano /etc/samba/smb.conf
In the smb.conf
file, you can set up different shared directories, adjust security settings, and define user access permissions. Here's an example of how to define a new share:
\[SharedDocs\]
path = /srv/samba/sharedocs
writable = yes
guest ok = no
valid users = @sambashare
This configuration sets up a share named 'SharedDocs' pointing to /srv/samba/sharedocs
, which is writable but not accessible by guests, and only accessible by users in the 'sambashare' group.
Create the directory that you want to share and set its permissions accordingly:
sudo mkdir -p /srv/samba/sharedocs
sudo chown nobody:nogroup /srv/samba/sharedocs
sudo chmod 0775 /srv/samba/sharedocs
To allow users to access the shared directory, you may need to add them to the sambashare group and create a Samba password:
sudo adduser your_username sambashare
sudo smbpasswd -a your_username
Replace your_username
with the actual username of the person needing access.
After configuring SAMBA, restart the service for changes to take effect:
sudo systemctl restart smbd
To ensure that your shares are correctly configured, use the smbclient
utility to list available shares:
smbclient -L localhost -U %
If everything is set up correctly, you should see your shared directories listed.
If you encounter issues accessing your shares, check the following:
/var/log/samba/
).根据你的 blkid
输出信息,/dev/sdb1
, /dev/sdc1
, 和 /dev/sdd1
是 linux_raid_member
类型的分区,表明它们是 RAID 0 阵列的一部分。你可以使用 mdadm
工具来组装和挂载 RAID 0 阵列。
mdadm
如果尚未安装 mdadm
,你需要先安装它。
sudo apt-get update
sudo apt-get install mdadm
使用 mdadm
来组装 RAID 阵列。你需要知道 RAID 阵列的设备名称(通常是 /dev/md0
)。
sudo mdadm --assemble --scan
这将自动扫描并组装 RAID 阵列。
你可以使用以下命令来验证 RAID 阵列是否已成功组装。
cat /proc/mdstat
输出应该显示类似以下内容:
Personalities : [raid0]
md0 : active raid0 sdd1[2] sdc1[1] sdb1[0]
117187328 blocks super 1.2 512k chunks
找到 RAID 阵列的设备名称(假设是 /dev/md0
),然后将其挂载到指定的挂载点。
sudo mkdir -p /mnt/raid0
sudo mount /dev/md0 /mnt/raid0
你可以使用 df -h
或 lsblk
来验证 RAID 阵列是否已成功挂载。
df -h
lsblk
如果你希望在每次启动时自动挂载 RAID 阵列,你需要编辑 /etc/fstab
文件。首先,获取 RAID 阵列的 UUID:
sudo blkid /dev/md0
复制 UUID,然后编辑 /etc/fstab
文件并添加以下行:
UUID=your-raid-uuid /mnt/raid0 ext4 defaults 0 0
将 your-raid-uuid
替换为你从 blkid
命令中获取的 UUID。
完成以上步骤后,你的 RAID 0 阵列应该已经成功组装并挂载到 /mnt/raid0
目录。
Step 1: Install the ‘sudo’ command
su -
id username
to checks user groups.Install Docker & Portainer 2.0 on Debian Based Distros!
sudo apt install docker.io
sudo systemctl start docker
sudo docker pull portainer/portainer-ce
sudo docker run --restart=always --name=portainer -d -p 9000:9000 -v /var/run/docker.sock:/var/run/docker.sock portainer/portainer-ce
http://[WORKSTATION_IP_ADDRESS]:9000
logout & login ssh.
Install docker-composesudo apt install docker-compose
Install docker-compose v2
Mount hardisk in armbian.
useful command
Let's suppose we have a single disk drive and want it to be available at /mnt/wd, run the following commands
sudo mkdir /mnt/wd
sudo chown -hR $(whoami):$(whoami) /mnt/wd
The next thing we have to do is edit /etc/fstab file and include the new path so that our disk drive will be recognized the next time we restart.
Run the following command and take a note of the ID number of the disk drive you want to automatically mount.
sudo blkid
Having the correct disk ID, we now edit /etc/fstab
sudo nano /etc/fstab
Then we add a new line to the end of /etc/fstab so that the system knows what to mount and where.
UUID="ID From blkid" /mnt/wd ext4 rw,user,auto 0 0
Reboot for it mount automatic.
Set up Samba Shares
Samba allows you to share files via the SMB network protocol. Basically this means file and print services for various Microsoft Windows clients and integration with a Microsoft Windows Server domain.
First you need to install samba and smbfs by running.
sudo apt-get install samba smbfs
After the installation is done, edit
/etc/samba/smb.conf
to include settings for the share folders. In the example, we're sharing /mnt/wd with both read and write permission.NAS share directory
Install dependencies:
sudo apt install samba samba-common-bin
Setup Network Shares Edit the Samba config:
sudo nano /etc/samba/smb.conf
Add the following to the end of the smb.conf file:This creates a share called “mynas” allowing access to all the drives mounted under the /mnt folder. Read-only is set to no, which permits modifying and writing data to the share. Browsable allows the share to be seen by a Linux file manager or Windows Explorer.
Add user account to access the Samba share Since Samba doesn’t use the system account password, we need to set up a Samba password for our user account: You can also specify a different username, although it must exist on the system.
sudo smbpasswd -a $(whoami)
sudo smbpasswd -a anotheruser
Restart Samba
sudo service smbd restart
Connect to the Share You can now connect to the share using \IP address of NAS from Windows Explorer.
If unable access from windows, try reboot windows and tested.
Or smb://IP address of NAS from a Linux file manager.
How To View Linux Machines from a Windows 10 Network
Installing WSD on Ubuntu wsdd is a service by christgau on GitHub, which implements a Web Service Discovery host daemon for Ubuntu. This enables Samba hosts to be found by Web Service Discovery Clients like Windows 10.
If you are experiencing any issues with this service, please let us know in the comments or submit an issue on GitHub.
Change to /tmp directory.
cd /tmp
Download and unzip the archive.
wget https://github.com/christgau/wsdd/archive/master.zip
unzip master.zip
Rename wsdd.py to wsdd.
sudo mv wsdd-master/src/wsdd.py wsdd-master/src/wsdd
Copy to /usr/bin.
sudo cp wsdd-master/src/wsdd /usr/bin
Copy wsdd to /etc/systemd/system.
sudo cp wsdd-master/etc/systemd/wsdd.service /etc/systemd/system
Open wsdd.service in nano and comment out User=nobody and Group=nobody with a ; semicolon.
sudo nano /etc/systemd/system/wsdd.service
If you found out below code different from yours just copy and paste it under [Service] to remove original code.
Save and exit (press CTRL + X, press Y and then press ENTER) Reload daemon.
sudo systemctl daemon-reload
Start and enable wsdd.
sudo systemctl start wsdd
sudo systemctl enable wsdd
Output:
Created symlink /etc/systemd/system/multi-user.target.wants/wsdd.service → /etc/systemd/system/wsdd.service.
Now check that the service is running.
sudo service wsdd status
Output:
● wsdd.service - Web Services Dynamic Discovery host daemon Loaded: loaded (/etc/systemd/system/wsdd.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2020-06-10 10:51:39 CEST; 8s ago Main PID: 40670 (python3) Tasks: 1 (limit: 6662) Memory: 10.8M CGroup: /system.slice/wsdd.service └─40670 python3 /usr/bin/wsdd --shortlog
jun 10 10:51:39 ubuntu systemd[1]: Started Web Services Dynamic Discovery host daemon. jun 10 10:51:40 ubuntu wsdd[40670]: WARNING: no interface given, using all interfaces
You should now be able to browse your Ubuntu machines and Samba shares in the Windows 10 file explorer. You may need to restart the Windows 10 machines to force discovery.
You may also want to reboot the Ubuntu server just to make sure the wsdd service starts up automatically without issue.
Disable zram Optional
sudo vim /etc/default/armbian-zram-config
A few lines down the file, uncomment the line that says SWAP=false:Zram swap enabled by default, unless set to disabled
SWAP=false Reboot, and the zram swap is gone.
Credits
https://devanswers.co/discover-ubuntu-machines-samba-shares-windows-10-network/