Current location - Quotes Website - Personality signature - linux shares a directory to other hosts and makes it writable by ordinary users
linux shares a directory to other hosts and makes it writable by ordinary users

Step one: Change smb.conf

Let’s implement the simplest function, allowing all users to read and write a folder shared by a Samba server; we To change smb.conf; first back up the smb.conf file;

[root@localhost ~]# cd /etc/samba

[root@localhost samba]# mv smb.conf smb.confBAK

Then re-create a smb.conf file;

[root@localhost samba]#touch smb.conf

Then put the following This section is written into smb.conf;

[global]

workgroup = WORKGROUP

netbios name = rayman_linux

server string = Linux Samba Server TestServer

security = share

[samba-files]

path = /home/rayman/samba_files

writeable = yes

browseable = yes

guest ok = yes

Note:

[global] This paragraph is a global configuration and is required. Written. There are the following lines;

workgroup is the workgroup displayed in Windows; here I set WORKGROUP

netbios name is the computer name displayed in Windows;< /p>

server string is the Samba server description, you can define it yourself; this is not important;

security This is the verification and login method, here we use share; there are many verification methods , this is one of them; the other commonly used is the user verification method; if you use share, you don’t need to set the user and password;

[samba-files] This is displayed in Windows The directory to be shared;

path = You can set where the directory to be shared is placed;

Whether writeable is writable, here I set it to be writable;

p>

browseable Whether it can be browsed, yes;

guest ok Anonymous users log in as guest;

Step 2: Create the corresponding directory and authorize it;

[root@localhost ~]# mkdir -p /home/rayman/samba_files

[root@localhost ~]# id nobody

uid=99(nobody) gid= 99(nobody) groups=99(nobody)

[root@localhost ~]# chown -R nobody:nobody /home/rayman/samba_files

Note: Regarding authorizing nobody, we First, we used the id command to check the information of the nobody user and found that his user group is also nobody. We should take this as the criterion.

In some systems, the nobody user group is not nobody;

Step 3: Start the smbd and nmbd servers;

[root@localhost ~]# smbd

[root @localhost ~]# nmbd

Step 4: Check the smbd process and confirm whether the Samba server is running;

[root@localhost ~]# pgrep smbd

< p>3147

3151

Step 5: Access the Samba server’s privileges;

In Linux, you can use the following command to access;

[root@localhost ~]# smbclient -L //rayman_linux

Password: Note: Just press Enter

In Windows, you can use the following method to access;

\\202.112.195.188

or

\\rayman_linux