Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
en:services:storage_services:file_service:smb_dienstprogramme:start [2015/08/12 13:43] – kheuer | en:services:storage_services:file_service:smb_dienstprogramme:start [2020/03/18 11:29] (current) – bnachtw | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== SMB/CIFS Utilities ===== | ||
+ | |||
+ | ===== CIFS/SMB ===== | ||
+ | |||
+ | The Common Internet File System (CIFS) offers the possibility to map network drives on Windows workstations; | ||
+ | |||
+ | ===== smbclient ===== | ||
+ | |||
+ | The '' | ||
+ | |||
+ | * listing network shares and network printers offered by windows servers, | ||
+ | * listing directory contents, | ||
+ | * or file transfer. | ||
+ | |||
+ | In the following, '' | ||
+ | |||
+ | ==== Listing network shares ==== | ||
+ | |||
+ | < | ||
+ | smbclient -L winfs-uni.top.gwdg.de -W GWDG -U lmuelle8 | ||
+ | Password: | ||
+ | </ | ||
+ | \\ | ||
+ | Although the password could be given directly on the command line, this should be avoided for security reasons; it is better to be prompted for the password. The output of the command has been omitted because it is very long. | ||
+ | |||
+ | ==== Listing directory contents ==== | ||
+ | |||
+ | < | ||
+ | smbclient // | ||
+ | Password: | ||
+ | Domain=[GWDG] OS=[Windows Server 2008 R2 Enterprise 7601 Service Pack 1] Server=[Windows Server 2008 R2 Enterprise 6.1] | ||
+ | smb: \> dir | ||
+ | . DR 0 Mon May 23 11:52:52 2011 | ||
+ | .. | ||
+ | $RECYCLE.BIN | ||
+ | Eigene Bilder | ||
+ | Eigene Musik DAR 0 Wed Jun 30 05:24:50 2010 | ||
+ | IO.SYS | ||
+ | MSDOS.SYS | ||
+ | My Music | ||
+ | My Pictures | ||
+ | My Videos | ||
+ | WINDOWS | ||
+ | _AdminsOnly | ||
+ | _GWDGsys | ||
+ | |||
+ | 65535 blocks of size 33554432. 18580 blocks available | ||
+ | smb: \> quit | ||
+ | </ | ||
+ | \\ | ||
+ | These directory entries didn't change for years, but that's life ... | ||
+ | |||
+ | Please notice the trailing %%$%% symbol within the name of the network share %%// | ||
+ | |||
+ | ==== File transfer ==== | ||
+ | |||
+ | < | ||
+ | smbclient // | ||
+ | Password: | ||
+ | Domain=[GWDG] OS=[Windows Server 2008 R2 Enterprise 7601 Service Pack 1] Server=[Windows Server 2008 R2 Enterprise 6.1] | ||
+ | smb: \> put example.doc | ||
+ | putting file example.doc as \example.doc (2142.8 kb/s) (average 2142.9 kb/s) | ||
+ | smb: \> cd "My Music" | ||
+ | smb: \My Music\> get laughter.mp3 | ||
+ | getting file \My Music\laughter.mp3 of size 3953876 as laughter.mp3 (16223.6 kb/s) (average 16223.6 kb/s) | ||
+ | smb: \My Music\> quit | ||
+ | </ | ||
+ | \\ | ||
+ | As demonstrated, | ||
+ | |||
+ | ==== Further help ==== | ||
+ | |||
+ | Help is available via manual page ('' | ||
+ | |||
+ | ===== SMB/CIFS mount ===== | ||
+ | |||
+ | ==== General remarks ==== | ||
+ | |||
+ | On FreeBSD or Linux systems, e.g., it is possible to mount a Windows network share into the local directory tree. Here, it is important to realize that it is inevitable to establish a user mapping while mounting the share. Thus on the one hand the user credentials on the remote Windows server as well as a local user name have to be specified. On the FreeBSD/ | ||
+ | |||
+ | Example user, server and share names are as described above within the context of '' | ||
+ | |||
+ | Please look at the manual pages on your system for further help if the examples below won't help. | ||
+ | |||
+ | ==== FreeBSD example ==== | ||
+ | |||
+ | < | ||
+ | mount_smbfs -U lmuelle8 -I winfs-uni.top.gwdg.de -W GWDG -u 1001 -g 20 // | ||
+ | Password: | ||
+ | </ | ||
+ | \\ | ||
+ | |||
+ | The password could be given in the command line, but should not for security reasons. Meaning of the arguments is: | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ==== Linux example ==== | ||
+ | |||
+ | < | ||
+ | mount.cifs -o domain=GWDG, | ||
+ | Password: | ||
+ | </ | ||
+ | \\ | ||
+ | |||
+ | The password could be given in the command line, but should not for security reasons. Meaning of the arguments is: | ||
+ | |||
+ | * '' | ||
+ | * '' | ||
+ | * '' | ||
+ | |||
+ | ==== persistent mount using a credentials file and fstab ==== | ||
+ | The mount.cifs command mentioned before works properly if you want to mount the share at once. For a persistent mounting the effort specifying the userid, domain, share URI and mountpoint and always entering the password may be not really comfortable. So you may want to mount the CIFS shares as you do with NFS by adding a line to the ''/ | ||
+ | # cat / | ||
+ | // | ||
+ | |||
+ | This skips out the mount command with all the options, but still requires to enter the password. If it's ok to store the password in your linux system, you can use a credential file instead of giving username, domain and password. Such a file looks like this (taking the example from above): | ||
+ | # cat / | ||
+ | domain=GWDG | ||
+ | username=lmuelle8 | ||
+ | password=< | ||
+ | | ||
+ | The line in the fstab file then looks like this: | ||
+ | |||
+ | # cat / | ||
+ | // | ||
+ | | ||
+ | if you want to mount different shares you can use the same credential file for each, if you need different credentials for different shares just setup different credential files, e.g. | ||
+ | |||
+ | # cat / | ||
+ | // | ||
+ | // | ||
+ | | ||
+ | <WRAP center round important 90%> | ||
+ | As the credentials file contains a plain text password, it should be strictly protected from other users accessing it. so please do set the access rights to 600 by | ||
+ | chmod 600 <path to credentials file> | ||
+ | </ | ||