Samba configuration
From Mandrivausers Wiki
This page discusses how to install and configure Samba on Mandriva.
Contents |
[edit] Installing Samba
The first thing we need to do is get some wizard action going. As root, open a console and type:
urpmi drakwizard
After all that's done, open up Mandriva Control Center and then go to Server Wizards -> Configure Samba. Say yes to any questions which get asked till you get to something similar to this screen.
This article needs a screenshot to illustrate it. As soon as file uploads are enabled, please add a screenshot here.
Hit Next and enter a name for your Workgroup. Hit Next two more times and choose an Access level. If you selected My rules you will now be given the option to refine which computers are allowed on your network. When at the Enable Samba server step DO NOT check file sharing area. You will not be able to finish the wizard. Continue through the wizard. If you had chosen to share printers, a configuration screen will be available to you.
Once this is done, you will need to configure your users. You will need to add your Windows logon id (XP only, I think, the Administrator users will be added by default for Win2k) to the users list. To do this, open a console and su to root. Then type:
smbpasswd -a USER
where USER is your Windows username. You will be prompted (twice) for a password for this user. Enter one you will remember. You will need it when you access your shares from your Windows PC, at least the first time.
[edit] Networking
[edit] Linux
To use samba between Linux computers, one machine needs to be a server (configured above) and the other needs to have smbclient installed. To do this, open a console and type:
urpmi libsmbclient
The computer with only smbclient installed will be able to access samba shares. The computer with smbclient AND the samba server install will be able to both serve and access shares.
[edit] Windows
To enable sharing in Windows open up the Control Panel and go to Network Connections. Right-click on your connection and select Properties. Make sure that both "Client for Microsoft Networks" and "File and Printer Sharing" are checked. Then right click on My Computer and go to Properties. Go to the Computer Name tab and click on the Change button. Select a sensible name for your computer and change the workgroup to the same one that made when you configured the samba server. It doesn't have to be the same, but it's neater this way.
[edit] Configuring Shares
Now comes the hard part, and for this we go to the Samba Configuration file. Open up /etc/samba/smb.conf and scroll all the way down to the bottom. Read the comments and select the type of share which you would like. Then modify the examples to fit your specific needs. For example, if I only want the user Illogic-al to be able to access my music share I'd change
# A private directory, usable only by fred. Note that fred requires write # access to the directory. [fredsdir] comment = Fred's Service path = /usr/somewhere/private valid users = fred public = no writable = yes printable = no
to this
# A private directory, usable only by fred. Note that fred requires write # access to the directory. [fredsdir] comment = Mah Muzak path = /mnt/Music valid users = illogic-al public = no writable = yes printable = no
The user illogic-al, of course, needs to be created using smbpassword, as stated above. The /etc/samba/smb.conf has more examples of potential sharing situations which users may want so go check it out.
For those longing for a graphical approach the samba-swat package or webmin package may be for you. Be aware however that after using samba-swat the comments in the smb.conf file will be gone. The comments provide useful information so I recommend backing up or making a copy before editing via SWAT. I'm unfamiliar with webmin and whether or not it too erases the comments.
[edit] To install SWAT
urpmi samba-swat
urpmi webmin
[edit] Security
There are various security options which are available to samba. Some are commented in the /etc/samba/smb.conf file and many others are documented via man or info pages. To access them type:
man smb.conf
or
info smb.conf
Two of these options will be demonstrated. Be very careful however as these options will make the system less secure.
Firstly we'll look at the security option. To allow access to certain shares (e.g. read-only public shares) without any logging in, change the option
security = user
in /etc/samba/smb.conf to
security = share
On Windows XP accounts are created by default without a password. Other accounts normally don't have passwords (e.g. the Guest user). If a user is added using smbpasswd samba will expect that user to have a password (even if you entered no password for the user). Therefore if you are a remote user from a Windows computer which has no password you won't be able to log in as samba will keep asking for a password. To disable this security option put
null passwords = yes
in your /etc/samba/smb.conf file.
After any changes are made to the smb.conf file, the samba server needs to be restarted to load them. To do this simply type as root:
service smb restart
[edit] Accessing Shares
[edit] Linux
There are various tools which are used to access samba shares. If you use konqueror or nautilus you can access samba share by typing
smb:/
in the address box. In konqueror it looks a little something like this
This article needs a screenshot to illustrate it. As soon as file uploads are enabled, please add a screenshot here.
It is also possible to use CLI tools to access samba shares. These tools are available with the samba-client package. To install this package provides smbmount which can be used to mount shares.
[edit] Windows
You can browse your Samba shares by going through Network Neighborhood. Simply click on it, browse to "Computers in my Workgroup" and you should see your Samba shares. You will be prompted, at least the first time, for your username and password. Alternatively, you can mount them as network drives. Right click on My Computer and go to Map Network Drive. Choose a drive letter, then click on the Browse button. Find your shares as above and mount them to your heart's content.


