I have installed the ubuntu-server 16.04 and VBoxLinuxadditions and Samba
I am trying to share a folder from this server to my windows host machine.
Now I can see this virtual server on my network but there are no shared folders on the server.
So i have figured this on my own and this is the easiest solution:
just install samba with
sudo apt install samba
and go to this file:
/etc/samba/smb.conf
and just at the bottom add these lines:
[share]
comment = Ubuntu File Server Share
path = /path/to/the/folder #for example /home/user_name/public <- this comment needs to be deleted!
browsable = yes
guest ok = yes
read only = no
create mask = 0755
restart the samba service
sudo service smbd restart
sudo service nmbd restart
All you have to do to share folders with SMB is
depending on the file manager you use, make sure nautilus-share or caja-share or ?-share is installed to enable next step
right-click on the folder and select the [Properties ->] Share tab that the file manager should provide
if that step doesn't propose to do it, install samba manually
choose the right sharing options and click Share
see https://help.ubuntu.com/community/Samba/SambaServerGuide#Ubuntu_Server
[allusers]
comment = All Users
path = /srv/samba/allusers/
valid users = @users
force group = users
create mask = 0660
directory mask = 0771
writable = yes
If all users shall be able to read and write to their home directories via Samba, edit the /etc/samba/smb.conf file and remove all lines. In vim:
Type gg to move the cursor to the first line of the file, if it is not already there.
Type dG to delete all the lines.
Now you should be able to log in from your Windows workstation with the file explorer using username ruchi and the chosen password and store files on the ubuntu server either in ruchi's home directory or in the public shared directory.
[global]
workgroup = WORKGROUP
#netbios name = [FRODO]
passdb backend = tdbsam
printcap name = cups
add user script = /usr/sbin/useradd -m %u
delete user script = /usr/sbin/userdel -r %u
add group script = /usr/sbin/groupadd %g
delete group script = /usr/sbin/groupdel %g
add user to group script = /usr/sbin/groupmod -A %u %g
delete user from group script = /usr/sbin/groupmod -R %u %g
add machine script = /usr/sbin/useradd -s /bin/false -d /var/lib/nobody %u
# Note: The following specifies the default logon script.
# Per user logon scripts can be specified in the user account using pdbedit
logon script = scripts\logon.bat
# This sets the default profile path. Set per user paths with pdbedit
logon path = \\%L\Profiles\%U
logon drive = H:
logon home = \\%L\%U
domain logons = Yes
os level = 35
preferred master = Yes
domain master = Yes
#[deprecated thus change
#idmap uid = 15000-20000
#idmap gid = 15000-20000
#]
#[
idmap config * : backend = tdb
idmap config * : range = 10001-20000
idmap config DOMAIN : backend = rid
idmap config DOMAIN : range = 10000-20000
idmap config DOMAIN : base_rid = 0
#]
printing = cups
Example 2.8. Engineering Office smb.conf (shares and services)
[homes]
comment = Home Directories
valid users = %S
read only = No
browseable = No
# Printing auto-share (makes printers available thru CUPS)
[printers]
comment = All Printers
path = /var/spool/samba
printer admin = root, maryo
create mask = 0600
guest ok = Yes
printable = Yes
browseable = No
[print$]
comment = Printer Drivers Share
path = /var/lib/samba/drivers
write list = maryo, root
printer admin = maryo, root
# Needed to support domain logons
[netlogon]
comment = Network Logon Service
path = /var/lib/samba/netlogon
admin users = root, maryo
guest ok = Yes
browseable = No
# For profiles to work, create a user directory under the path
# shown. i.e., mkdir -p /var/lib/samba/profiles/maryo
[Profiles]
comment = Roaming Profile Share
path = /var/lib/samba/profiles
read only = No
profile acls = Yes
So i have figured this on my own and this is the easiest solution:
just install samba with
and go to this file:
and just at the bottom add these lines:
restart the samba service
and that's it, easy peasy :)
All you have to do to share folders with SMB is
depending on the file manager you use, make sure nautilus-share or caja-share or ?-share is installed to enable next step
right-click on the folder and select the [Properties ->] Share tab that the file manager should provide
if that step doesn't propose to do it, install samba manually
choose the right sharing options and click Share
see https://help.ubuntu.com/community/Samba/SambaServerGuide#Ubuntu_Server
To add a share that is accessible by all users.
Create the directory for sharing the files and change the owner to the users group.
Adding and managing users
eg. for group
users
and usermattu
:Set a password for mattu
Enter the password for the new user
Now add the user to the Samba user database.
Enter the password for the new user
Edit the /etc/samba/smb.conf file
add the following lines and save the file
If all users shall be able to read and write to their home directories via Samba, edit the /etc/samba/smb.conf file and remove all lines. In vim:
gg
to move the cursor to the first line of the file, if it is not already there.dG
to delete all the lines.Now you should be able to log in from your Windows workstation with the file explorer using username ruchi and the chosen password and store files on the ubuntu server either in ruchi's home directory or in the public shared directory.