SAMBA

From wiki-ben
Jump to: navigation, search

Install SAMBA

dnf install samba

Configure SAMBA

For the most basic configuration and security setup, append the following to the bottom of the file

[NFSHARE]
	comment= <share-folder-comment>
	path = <dir-to-share>
	public = <yes|no>
	writable = <yes|no>
	guest ok = <yes|no>
	printable = <yes|no>

Comment is just a comment that can be used to help identify the share.
Path is the directory that is being shared through SAMBA
Public is to enable public access to the share folder
Writable is to enable writing to the share folder
Guest Ok enabled anonymous access to the share folder
Printable is whether SAMBA will share printer access through this share folder

Start SAMBA

Fedora/CentOS

  1. Start the SMB service: systemctl start smb.service
  2. Then start the SAMBA server: systemctl start smb
  • You can check if your mount has worked with the following command: smbclient -L localhost

Note that at this point no user accounts have been configured for SAMBA so the only authetnication available is anonymous access. When you run the above command it will prompt to enter a password. Do not enter a password and hit enter. This will attempt to then connect as if you are anonymous.

User Permissions On SAMBA

By default SAMBA is configured with 'user' security. For this report were going to configure further this default setup. To add security, were going to add a user and password. With how SAMBA is built, these credentials must match a user and password on the linux system.

Add a SAMBA user with this command:

smbpasswd -a <username-of-user-on-linux-system> 

Press enter and you may be prompted to enter a password for the account. Add the same password as the account password is to login to the linux system. Note: If the user account has its password changed at a later time, this password will have to be updated for the account to work To update a SAMABA user's pasword use this command:

smbpasswd <username-of-user-on-linux-system> 

SAMBA with Xinetd

You can configure Xinetd to manage SAMBA aswell for additional security.

The following entries in the /etc/xinetd.conf will add it:

server netbios-ns
{
    socket_type = dgram
    protocol = udp
    wait = yes
    user = root
    only_from = 192.168.0.1 192.168.0.2
    group = root
    server = /urs/local/sama/bin/smbd
}

server netbios-ssn
{
    socket_type = stream
    protocol = tcp
    wait = no
    user = root
    only_from = 192.168.0.1 192.168.0.2
    group = root
    server = /usr/local/samba/bin/smbd
}

To see details on configuring Xinetd see the appropriate page

Notes

Sources