This is the second post of our series about installing, configuring and managing Samba in Ubuntu Linux. The first post can be found here.
In this post, we’re going to show you how to add Samba user so that the user can access shares on Ubuntu or Linux machine from a remote computer. Adding Samba user is important because without it, it might prevent the user from accessing shares from a remote computer.
Samba has an access control list (smbpasswd file) of users who should have access to Samba shares. These users must already be active on the Linux machine before they can be added to Samba user list.
If a user does not have an account on the machine, he/she can’t be added to smbpasswd file.
Adding Samba user on Ubuntu Server
To add Samba user on Ubuntu server, open the terminal and run the commands below.
smbpasswd -a usernameusername should be replaced with the actual user account name.
When you run the command above, it should prompt you to create a password for the user. Create one, maybe one that matches your Ubuntu account password.
Next, to give the user access to a particular share, open the smb.conf file at /etc/samba/smb.conf and create share as followed below.
[database]comment = Database Filepath = /data/databasevalid users = usernamepublic = nowritable = yesreplace username with the actual account name and save the file.
Adding Samba user on Ubuntu Desktop
The above steps above should also work on Ubuntu desktops. However, since most desktop users use GUI to manage stuff, open Samba from Unity Dash.
Next, select Preferences –> Samba Users
Then click ‘Add’ and select an existing user account, then create the Windows username and password for the account. This is the same as what we did for Ubuntu server setup.
To give the user access to shares, create a share and select Access tab, then select the username you wish to have access to the shares and save.
This is how Samba users are create and provided access to resources.
Enjoy!
Frequently Asked Questions
How to add Samba user in Ubuntu Linux?
To add a Samba user in Ubuntu Linux, open the terminal and run the command 'smbpasswd -a username', replacing 'username' with the actual user account name.
What is the importance of adding Samba users in Ubuntu?
Adding Samba users in Ubuntu is important as it allows users to access shares on Ubuntu or Linux machines from remote computers. Without adding Samba users, access to shares may be restricted.
How can Samba users be added to the smbpasswd file?
Samba users can be added to the smbpasswd file by ensuring that they are active users on the Linux machine first. If a user does not have an account on the machine, they cannot be added to the smbpasswd file.
What is the process to add Samba users on Ubuntu Server?
To add Samba users on Ubuntu Server, open the terminal and run 'smbpasswd -a username', where 'username' is the actual user account name. You will be prompted to create a password for the user.
Can the same steps be used to add Samba users on Ubuntu Desktop?
Yes, the same steps to add Samba users on Ubuntu Server can be used on Ubuntu Desktop. Open Samba from Unity Dash, select Preferences, then Samba Users, and click 'Add' to create a Windows username and password.
Where can Samba user details be configured on Ubuntu?
Samba user details can be configured in the smb.conf file located at /etc/samba/smb.conf. Here, you can define shares and set permissions for users.
What permissions can be set for Samba users on Ubuntu?
When adding a Samba user on Ubuntu, you can set permissions such as 'valid users', 'public', and 'writable' in the smb.conf file to control access to shares.
What is the purpose of the access control list (smbpasswd file) in Samba?
The access control list (smbpasswd file) in Samba contains users who are authorized to access Samba shares. Users must have active accounts on the Linux machine before being added to this list.