The preferred mode of security with Samba is
user-level security. With this method, each share is assigned specific users that can access it. When a user requests a connection to a share, Samba authenticates by validating the given username and password with the authorized users in the configuration file and the passwords in the password database of the Samba server. As mentioned earlier in the chapter, one way to isolate which users are allowed access to a specific share is by using the
valid
users
option for each share:
[global]
security = user
[accounting1]
writable = yes
valid users = bob, joe, sandy
Each of the users listed will be allowed to connect to the share if the password provided matches the password stored in the system password database on the server. Once the initial authentication succeeds, the user will not need to re-enter a password again to access that share unless the
revalidate
=
yes
option has been set.
Passwords can be sent to the Samba server in either an encrypted or a non-encrypted format. If you have both types of systems on your network, you should ensure that the passwords represented by each user are stored both in a traditional account database and Samba's encrypted password database. This way, authorized users can gain access to their shares from any type of client.[
] However, we recommend that you move your system to encrypted passwords and abandon non-encrypted passwords if security is an issue. The
Section 6.4" section of this chapter explains how to use encrypted as well as non-encrypted passwords.