Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
en:guides:samba [2013/04/27 18:52] emgi [Running a Samba Server on Slitaz] |
en:guides:samba [2013/04/30 22:12] (current) linea |
||
---|---|---|---|
Line 18: | Line 18: | ||
Enter User's password: **** | Enter User's password: **** | ||
</code> | </code> | ||
- | This will provide a list of the shares available on the machine called nas. Although not strictly required, it is recommended to add the server name to /etc/hosts for name resolution when it has a fixed ip address. Because we are running on Linux we need to 'escape' the backslashes in the UNC path, effectively needing twice the number of them like this: | + | This will provide a list of the shares available on \\nas. The result should look similar to the example below: |
+ | <code> | ||
+ | Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.3-31a.osstech] | ||
+ | |||
+ | Sharename Type Comment | ||
+ | --------- ---- ------- | ||
+ | IPC$ IPC IPC Service ("My NAS") | ||
+ | webaxs Disk | ||
+ | share Disk LinkStation folder | ||
+ | info Disk LinkStation Utilities | ||
+ | Domain=[WORKGROUP] OS=[Unix] Server=[Samba 3.6.3-31a.osstech] | ||
+ | |||
+ | Server Comment | ||
+ | --------- ------- | ||
+ | NAS My NAS | ||
+ | |||
+ | Workgroup Master | ||
+ | --------- ------- | ||
+ | WORKGROUP NAS | ||
+ | # | ||
+ | </code> | ||
+ | From the above example, we are interested in access to Sharename 'share'. Although not strictly required, it is recommended to add the server name to /etc/hosts for name resolution when it has a fixed ip address. Because we are running on Linux we need to 'escape' the backslashes in the UNC path, effectively needing twice the number of them. Accessing \share on \\nas goes like this: | ||
<code> | <code> | ||
# smbclient \\\\nas\\share | # smbclient \\\\nas\\share | ||
Line 24: | Line 45: | ||
smb: \> | smb: \> | ||
</code> | </code> | ||
- | At this prompt you can issue ftp-style commands to browse the file system and read/write files. | + | At the prompt you can issue ftp-style commands to browse the file system and read/write files. Typing **help** gives you a summary of the options: |
+ | <code> | ||
+ | smb: \> help | ||
+ | ? allinfo altname archive blocksize | ||
+ | cancel case_sensitive cd chmod chown | ||
+ | close del dir du echo | ||
+ | exit get getfacl hardlink help | ||
+ | history iosize lcd link lock | ||
+ | lowercase ls l mask md | ||
+ | mget mkdir more mput newer | ||
+ | open posix posix_encrypt posix_open posix_mkdir | ||
+ | posix_rmdir posix_unlink print prompt put | ||
+ | pwd q queue quit readlink | ||
+ | rd recurse reget rename reput | ||
+ | rm rmdir showacls setmode stat | ||
+ | symlink tar tarmode translate unlock | ||
+ | volume vuid wdel logon listconnect | ||
+ | showconnect .. ! | ||
+ | smb: \> quit | ||
+ | # | ||
+ | </code> | ||
Fortunately you can also access a Windows share by mounting it on your box like this: | Fortunately you can also access a Windows share by mounting it on your box like this: | ||
Line 31: | Line 72: | ||
# mkdir /nas | # mkdir /nas | ||
# | # | ||
+ | </code> | ||
Then issue the mount command: | Then issue the mount command: | ||
+ | <code> | ||
+ | # mount.cifs \\\\nas\\share /nas -o user=admin | ||
+ | Password: ****** | ||
+ | # | ||
+ | </code> | ||
+ | |||
+ | An alternative method is like this: | ||
+ | <code> | ||
# mount //nas/share /nas | # mount //nas/share /nas | ||
Password: ****** | Password: ****** | ||
# | # | ||
</code> | </code> | ||
- | If there is no access-denied-message in reply to the password, it means the share is mounted and can be accesssed from your box. That's basically it! | + | If there is no access-denied-message in reply to the password, it means the share is mounted and can be accessed from your box. That's basically it! |
- | <note tip>The password must be the admin password for your storage device. This may not work when you have enabled user-based security on your storage device. </note> | + | <note tip>The password must be the admin password for your storage device. This may not work when you have enabled user-based security. In some cases the mount may be read-only. </note> |
Many of the problems with Samba are caused by a lack of understanding the Windows security mechanism. In its basic version, which is still used most of the time, this is user-based security so you will need a **valid windows user account** to access the file share. When in trouble, verify the access is working from a windows machine and use the same credentials under Linux. | Many of the problems with Samba are caused by a lack of understanding the Windows security mechanism. In its basic version, which is still used most of the time, this is user-based security so you will need a **valid windows user account** to access the file share. When in trouble, verify the access is working from a windows machine and use the same credentials under Linux. | ||
====== Running a Samba Server on Slitaz ====== | ====== Running a Samba Server on Slitaz ====== | ||
- | If you need to set up a Windows file server but you don't want to invest in over-the-top hardware and Windows licenses, Samba is the way to go. Of course you can use Slitaz as the Linux platform to run the server. With this solution you will also benefit from the superior stability of the Linux OS. One of the problems of a Samba administrator is that he sometimes forgets the details of the installation because everything simply keeps on running once it has been set up properly. This is one of the reasons why Linux people need documentation anyway. ;-) | + | If you need to set up a Windows file server but you don't want to invest in over-the-top hardware and Windows licenses, Samba is the way to go. Of course you can use Slitaz as the Linux platform to run the server. With this solution you will also benefit from the superior stability of the Linux OS. One of the problems of a Samba administrator is that he sometimes forgets the details of his installation because everything simply keeps on running once it has been set up properly. This is one of the reasons why Linux people need documentation anyway. ;-) |
To install the server component of Samba, install the following package: | To install the server component of Samba, install the following package: | ||
Line 50: | Line 100: | ||
The procedure to add a user to your samba server: | The procedure to add a user to your samba server: | ||
- | <code> | ||
- | [a] First add Linux user using the adduser command. | ||
- | [b] Then add the same user name to Samba using: smbpasswd -a | + | First add Linux user using the adduser command. |
+ | <code># adduser smbuser01 | ||
+ | Changing password for smbuser01 | ||
+ | New password: | ||
+ | Retype password: | ||
+ | Password for smbuser01 changed by root | ||
+ | </code> | ||
- | Use: smbpasswd --help to view the options. | + | Then add the same user name to Samba using: smbpasswd -a |
+ | <code> | ||
+ | # smbpasswd -a smbuser01 | ||
+ | New SMB password: | ||
+ | Retype new SMB password: | ||
+ | Added user smbuser01. | ||
+ | # | ||
</code> | </code> | ||
+ | Use: smbpasswd -h to view the options. | ||
The file shares and printers you want to allow your Windows clients access to can be defined in the Samba configuration file which is: **/etc/samba/smb.conf** | The file shares and printers you want to allow your Windows clients access to can be defined in the Samba configuration file which is: **/etc/samba/smb.conf** |