The installation of the latest XBMC 12.0 “Frodo” includes Samba server installed by default. So, right after the installation completed you have Samba on your XBMC box running and preconfigured with Samba shares – movies, pictures, music, system etc.
You can see the Samba process running on your XBMCbuntu machine if you SSH to it, and run:
$ ps -aux | grep smb
If you for any reason would like to get rid of Samba completely (for example, you have Samba running on some other machines in your network, or simply concerned about use of resources on your media box etc.) – you can follow the steps below to completely remove Samba from your system:
1. Stop Samba processes
$ sudo stop smbd
2. Remove Samba
#You run autoremove command, so it will get rid of other packages installed during the Samba installation, such as libfile-copy-recursive-perl tdb-tools update-inetd. These packages no longer required.
$ sudo apt-get autoremove samba
#This command leaves the configuration files intact, so if you decide to install Samba back later – you would have your shares configured the way it was originally. You can still see the smb.conf file:
$ less /etc/samba/smb.conf
This is basically it, you can reboot the XBMC – you won’t see Samba running and those Samba shares are not available anymore.
Showing posts with label Samba. Show all posts
Showing posts with label Samba. Show all posts
Monday, March 11, 2013
Sunday, March 10, 2013
Accessing Samba shares on Ubuntu - Security Considerations - Updated
Here is an update on my finding for Samba configuration.
As I said before, I have various clients accessing my Samba server - including Windows, Ubuntu and Mac. However, it turned out this is not an issue on the client side - it was an issue on the Samba server side. The fact that I was able to connect to Samba share from Windows was connected to the user privileges, that particular Windows user just had all possible privileges assigned on the Linux server hosting Samba.
My smb.conf file is configured to require a Unix account in the Linux server hosting Samba for every user accessing the server ( i.e., it has "security" parameter set to "user").
So, imagine you have powerUser who should have a write access to share and readOnlyUser who has a read only access to the same share. Here is an example of such share configuration in smb.conf file:
[movies]
path = /mnt/downloads/movies
read only = yes
guest ok = no
force group = sambashare
write list = powerUser
This is a definition of a read only share with no guest users allowed, forcing the users with assigned primary group "sambashare" to access it. The powerUser has a write permission as intended.
Below I compiled a list of steps to eliminate permission related issues when clients from various OSs connect to the Samba share above:
sudo useradd powerUser
sudo usermod -a -G sambashare powerUser
# Create readOnlyUser
sudo useradd -g sambashare readOnlyUser
# Set user passwords, make sure password used are the same as user password used on any other client machines accessing Samba.
sudo passwd powerUser
sudo passwd readOnlyUser
sudo smbpasswd -L -a powerUser
sudo smbpasswd -L -a readOnlyUser
# Activate both user accounts in Samba
sudo smbpasswd -L -e powerUser
sudo smbpasswd -L -e readOnlyUser
/mnt/downloads$ sudo mkdir movies
# Assign ownership of this folder to powerUser
/mnt/downloads$ sudo chown powerUser movies
# Assign group ownership of this folder to sambashare group
/mnt/downloads$sudo chgrp –R sambashare movies
# Set the permissions on the Samba share folder for owner (powerUser) of this folder to read/write/execute and for sambashare group (readOnlyUser) to read/execute only
/mnt/downloads$ chmod 750 movies
# Set a group sticky bit on Samba share folder, so new files created by powerUser has a sambashare group ownership assigned - i.e., can be accessed by sambashare group (readOnlyUser)
/mnt/downloads$ sudo chmod g+s movies
su readOnlyUser
# Validate readOnlyUser has access to Samba share folder
cd /mnt/downloads/movies
ls -al
path = /mnt/downloads/movies
read only = yes
guest ok = no
force group = sambashare
write list = powerUser
As I said before, I have various clients accessing my Samba server - including Windows, Ubuntu and Mac. However, it turned out this is not an issue on the client side - it was an issue on the Samba server side. The fact that I was able to connect to Samba share from Windows was connected to the user privileges, that particular Windows user just had all possible privileges assigned on the Linux server hosting Samba.
My smb.conf file is configured to require a Unix account in the Linux server hosting Samba for every user accessing the server ( i.e., it has "security" parameter set to "user").
So, imagine you have powerUser who should have a write access to share and readOnlyUser who has a read only access to the same share. Here is an example of such share configuration in smb.conf file:
[movies]
path = /mnt/downloads/movies
read only = yes
guest ok = no
force group = sambashare
write list = powerUser
This is a definition of a read only share with no guest users allowed, forcing the users with assigned primary group "sambashare" to access it. The powerUser has a write permission as intended.
Below I compiled a list of steps to eliminate permission related issues when clients from various OSs connect to the Samba share above:
- Make sure these user accounts created on the Linux machine hosting Samba server:
sudo useradd powerUser
sudo usermod -a -G sambashare powerUser
# Create readOnlyUser
sudo useradd -g sambashare readOnlyUser
# Set user passwords, make sure password used are the same as user password used on any other client machines accessing Samba.
sudo passwd powerUser
sudo passwd readOnlyUser
- Add users to Samba:
sudo smbpasswd -L -a powerUser
sudo smbpasswd -L -a readOnlyUser
# Activate both user accounts in Samba
sudo smbpasswd -L -e powerUser
sudo smbpasswd -L -e readOnlyUser
- Configure a file security of the Samba share folder:
/mnt/downloads$ sudo mkdir movies
# Assign ownership of this folder to powerUser
/mnt/downloads$ sudo chown powerUser movies
# Assign group ownership of this folder to sambashare group
/mnt/downloads$sudo chgrp –R sambashare movies
# Set the permissions on the Samba share folder for owner (powerUser) of this folder to read/write/execute and for sambashare group (readOnlyUser) to read/execute only
/mnt/downloads$ chmod 750 movies
# Set a group sticky bit on Samba share folder, so new files created by powerUser has a sambashare group ownership assigned - i.e., can be accessed by sambashare group (readOnlyUser)
/mnt/downloads$ sudo chmod g+s movies
- Test users can access a folder content on Linux server, before trying to access a Samba share. This step would eliminate a lot of time troubleshooting users not being able to access a Samba share by making sure the Linux permission to shared folder are set correctly:
su readOnlyUser
# Validate readOnlyUser has access to Samba share folder
cd /mnt/downloads/movies
ls -al
- Add a share configuration to /etc/samba/smb.conf as stated above:
path = /mnt/downloads/movies
read only = yes
guest ok = no
force group = sambashare
write list = powerUser
- Restart Samba share:
- Access Samba share from any of your client machines.
Sunday, March 3, 2013
Accessing Samba shares on Ubuntu - Security Considerations
If you, like me, have spent hours looking for how Samba manages an access to shares - then you might want to read this. I am not going to cover the configuration of Samba on your system - I assume you have defined shares and other required parameters in smb.conf file - this part should be relatively easy, and it is pretty well covered on many other sites.
My Samba server setup on Linux machine, and clients accessing shares are on Windows, Linux (Ubuntu) and Mac - the whole variety is here!:)
So far I encountered no problems connecting from Windows to Samba, however having issues connecting from Ubuntu to Samba (!) - getting NT_STATUS_ACCESS_DENIED from Samba server... I should say Samba logs are huge, and do not contain logging categories (I am looking for security messages only) - but the log level can be defined. I have set the log level to 3 (out of 10) - and logs are really big!
I am still looking for the trick to fix the system - exciting! I will keep the updates posted....
My Samba server setup on Linux machine, and clients accessing shares are on Windows, Linux (Ubuntu) and Mac - the whole variety is here!:)
So far I encountered no problems connecting from Windows to Samba, however having issues connecting from Ubuntu to Samba (!) - getting NT_STATUS_ACCESS_DENIED from Samba server... I should say Samba logs are huge, and do not contain logging categories (I am looking for security messages only) - but the log level can be defined. I have set the log level to 3 (out of 10) - and logs are really big!
I am still looking for the trick to fix the system - exciting! I will keep the updates posted....
Subscribe to:
Posts (Atom)