该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
1 Preliminary Note
I*m using an OpenSUSE 12.3 system here with the hostname server1.example.com and the IP address 192.168.0.100.
2 Installing Samba
We can install Samba as follows:
zypper install cups-libs samba
Unfortunately Samba conflicts with the package patterns-openSUSE-minimal_base-conflicts. Therefore we must choose to uninstall that package:
server1:~ # zypper install cups-libs samba
Loading repository data...
Reading installed packages...
*cups-libs* is already installed.
No update candidate for *cups-libs-1.5.4-5.2.1.x86_64*. The highest available version is already installed.
Resolving package dependencies...
Problem: samba-3.6.12-59.2.1.x86_64 requires samba-client >= 3.6.12, but this requirement cannot be provided
uninstallable providers: samba-client-3.6.12-59.2.1.x86_64[openSUSE-12.3-1.7]
samba-client-3.6.12-59.2.1.i586[repo-oss]
samba-client-3.6.12-59.2.1.x86_64[repo-oss]
Solution 1: deinstallation of patterns-openSUSE-minimal_base-conflicts-12.3-7.10.1.x86_64
Solution 2: do not install samba-3.6.12-59.2.1.x86_64
Solution 3: do not install samba-3.6.12-59.2.1.x86_64
Solution 4: break samba-3.6.12-59.2.1.x86_64 by ignoring some of its dependencies
Choose from above solutions by number or cancel [1/2/3/4/c] (c):
Edit the smb.conf file:
vi /etc/samba/smb.conf
Make sure you have the following lines in the [global] section:
[...] security = user passdb backend = tdbsam[...]
This enables Linux system users to log in to the Samba server.
(If you get the message You do not have a valid vim binary package installed. Please install either "vim", "vim-enhanced" or "gvim"., please run
zypper install vim
to install vi and try again. )
Then create the system startup links for Samba and start it:
systemctl enable smb.service
systemctl start smb.service
3 Adding Samba Shares
Now I will add a share that is accessible by all users.
Create the directory for sharing the files and change the group to the users group:
mkdir -p /home/shares/allusers
chown -R root:users /home/shares/allusers/
chmod -R ug+rwx,o+rx-w /home/shares/allusers/
At the end of the file /etc/samba/smb.conf add the following lines:
vi /etc/samba/smb.conf
[...][allusers] comment = All Users path = /home/shares/allusers valid users = @users force group = users create mask = 0660 directory mask = 0771 writable = yes
If you want all users to be able to read and write to their home directories via Samba, add the following lines to /etc/samba/smb.conf (make sure you comment out or remove the other[homes] section in the smb.conf file!):
[...][homes] comment = Home Directories browseable = no valid users = %S writable = yes create mask = 0700 directory mask = 0700
Now we restart Samba:
systemctl restart smb.service
4 Adding And Managing Users
In this example, I will add a user named tom. You can add as many users as you need in the same way, just replace the username tom with the desired username in the commands.
useradd tom -m -G users
(If you see the following error, please ignore it:
server1:~ # useradd tom -m -G users
configuration error - unknown item *LASTLOG_ENAB* (notify administrator)
server1:~ #
)
Set a password for tom in the Linux system user database. If the user tom should not be able to log in to the Linux system, skip this step.
passwd tom
-> Enter the password for the new user.
Now add the user to the Samba user database:
smbpasswd -a tom
-> Enter the password for the new user.
Now you should be able to log in from your Windows workstation with the file explorer (address is \\192.168.0.100 or \\192.168.0.100\tom for tom*s home directory) using the usernametom and the chosen password and store files on the Linux server either in tom*s home directory or in the public shared directory.
照着这个做了一遍也没用。。。