Samba server setup (unraid is also share disk sharing based on samba):
samba -V //Check whether the smb server is installed. Install apt install samba if not installed, unraid itself is also based on samba
vim /etc/samba/smb.conf
1. Add the following content at the end of the smb.conf file, do not add the following comments! Do not add subsequent comments! Do not add subsequent comments!
[shared_aosp] # Display the name of the shared directory when Windows accesses the Samba server, the name is arbitrary
comment = shared_aosp # Description of the shared directory, just write
browseable = yes # Whether the shared directory is visible, no is invisible, yes or no write is visible by default
path = /home/xxdty/workspace/aosp # shared directory path
create mask = 0775 #Default permissions for creating files
directory mask = 0775 # Default permission to create directories
valid users = xxdty # Specify the user to log in. If this item is not written, it will be visible to everyone by default. The user must be an existing user on Ubuntu
force user = nobody # The specified user can log in, other users have no permission to log in, nobody is not restricted
force group = nogroup # The specified user group can log in, other groups have no permission to log in, nobody is not restricted
public = yes # Whether it is visible to all users who have successfully logged in
writable = yes # Used to specify whether the shared path is writable
available = yes # Set whether the shared directory is visible
Please refer to the detailed explanation of smb.conf configuration: https://www.cnblogs.com/sswind/p/12060842.html
2. Set the access user and password for the samba server
# Set the access user and password for the samba server, this user must be an existing user on Ubuntu
xxdty@ubuntu20:~/workspace/aosp$ sudo smbpasswd -a xxdty
New SMB password:
Retype new SMB password:
Added user xxdty.
Execute the command /etc/rc.d/rc.samba restart to restart the smb server
unraid configure share sharing
Remarks: The Unraid web interface needs to be logged in with root, and the shared folder needs to be logged in with non-root.
There are some common tools on the right side of Unraid:
Enter the unraid command line interface: unraid web interface -> upper right corner -> second icon
unraid configuration share configuration:
Set the Share name to ECMaster, and use unraid as the default for other configurations.
Modify SMB Security Settings: Select export as Yes, security as Secure, and then click apply
Then modify SMB User Access: Then click apply
Note: You need to add a new user to USERS. Root cannot be used for SMB login.
If the following SMB field is not -, it means the configuration file is successfully written:
/etc/samba/smb-shares.conf is the smb configuration parameters for the shares shared files configured in unraid
[ECMaster]
path = /mnt/user/ECMaster # Shared directory path
comment =
browseable = yes # Whether the shared directory is visible, no is invisible, yes or no write is visible by default
# Secure
public = yes # Whether it is visible to all users who have successfully logged in
writeable = no # Used to specify whether the shared path is writable
write list = ecmaster
case sensitive = auto
preserve case = yes
short preserve case = yes
vfs objects = catia fruit streams_xattr
fruit:encoding = native
Delete empty shared files:
There is isDelete in Share Settings, check it and click delete (only empty folders will be deleted)
Or delete it directly using the command line: rm -rf share directory
Client connects to shared disk (smb server)
Smb client connection (linux):
1. Linux connects to the shared smb server: apt-get install smbclient
smbclient -L //10.1.1.10 -The ecmaster
smbclient -L 10.1.1.10 -U ecmaster //Enter the password to view the shared directory
The above two commands use the FTP address expression format and the IP address expression method respectively. I personally tested both of them under ubuntu13.04.
Sharename Type Comment
--------- ---- -------
IPC$ IPC IPC Service (Media server)
SMB1 disabled -- no workgroup available
If shares are added, but no accessible shares can be seen here, it may be that the share configuration in unraid has not been written into /etc/samba/smb-shares.conf.
Solution: Modify the SMB Security Settings and click Apply to re-trigger writing the configuration file.
2. Then you can access the specific directory:
smbclient \\10.1.1.10\IPC$ -U ecmaster
smb: \>
You can use cd (enter the directory), ls (list files and folders), get (download files), put (upload files) and other commands to perform corresponding operations.
Mac connects to the smb server through Finder-Go-Connect to Server:
The format is: smb://ip/shareName
Common errors:
session setup failed: NT_STATUS_LOGON_FAILURE
This is because the user ID executing the smbclient command has not become the user of the samba service. The solution is as follows:
First add the user ID to samba: ~$ smbpasswd -a user ID
Set the password as required, so that the user ID becomes the user of the samba service.
tree connect failed: NT_STATUS_BAD_NETWORK_NAME
1. SElinux needs to be turned off: /usr/sbin/setenforce 0
You can edit the configuration file to achieve the same purpose vi /etc/selinux/conf
SELINUX=disabled
2. The specified shared path path is incorrect or does not exist. Chinese characters cannot be included in the path, because some versions do not support Chinese well enough.