EzDevInfo.com

samba interview questions

Top samba frequently asked interview questions

Listing available smb shares on a network through the command line in linux

I was wondering if there is a way of listing all the smb servers on a local network (like looking at a network neighborhood in windows) via the command line in fedora.


Source: (StackOverflow)

Mount CIFS share gives "mount error 127 = Key has expired"

I'm currently replicating the setup of a CentOS box an am running into a strange error while trying to mount a samba share that resides on a NAS. The error I'm getting is:

mount error 127 = Key has expired

Refer to the mount.cifs(8) manual page (e.g.man mount.cifs)

The settings are identical to the old machine, the password is definitely correct as well. I have googled the issue of course, and looked at every single page that references this issue (not that many) and have still not found an answer.

The older CentOS box is using version 3.0.28-0.el4.9 of Samba and the one I'm trying to setup now is 3.0.33-3.7.el5_3.1. I don't know if this has anything to do with it but it's certainly one of the only differences between the 2 setups.

When I try the mount command this appears in the syslog:

Sep 8 10:51:54 helvetica2 kernel: Status code returned 0xc0000072 NT_STATUS_ACCOUNT_DISABLED

Sep 8 10:51:54 helvetica2 kernel: CIFS VFS: Send error in SessSetup = -127

Sep 8 10:51:54 helvetica2 kernel: CIFS VFS: cifs_mount failed w/return code = -127

The account is very much not disabled as it works on the old box using the same credentials.

Has anyone else seen this problem?

Thanks!


Source: (StackOverflow)

Advertisements

Windows7 - “The specified network password is not correct.” when the password is in fact correct

I have a samba server setup for some time now. It is a Hardware NAS - which unfortunately does not provide access to the Samba logs. (the exact model of the NAS is called Addonics NAS Adapter )

I also have a Windows Vista and a Windows XP machine - from both I am able to map \\192.168.0.20\Smd with no errors ( net use l: \\192.168.0.20\Smd works, after asking for my username and password).

I also bought a brand new computer, with Windows 7, and when I try to execute the same exact net use command on it - using the exact same username/password pair, I get a "The specified network password is not correct." message. I also tried mapping from the Windows explorer menu, and got the same error.

I synchronized the clocks of the two machines, tried again... and yet the same error persists.

So what is really surprising here is that mapping works from WindowXP and Windows Vista machines, but fails from a Windows7 machine using the exact same command and username/password - Anyone has any idea of what could be causing this or how to solve the problem? Thanks


Source: (StackOverflow)

How do I get SELinux to allow Apache and Samba on the same folder?

In the configuration I have setup I wish to allow samba and apache to access /var/www I am able to set a context to allow samba access, but then httpd doesn't have access. Using setenforce to 0 eliminates issues so I know that it is SELinux.

In addition: How can I view the context of a folder, and can a folder have multiple contexts?

(CentOS)

Thank you, Josh


Source: (StackOverflow)

Can Samba support full Windows-ACLs?

I've set up a Samba 3 host with AD integration and an ACL enabled filesystem. Using a windows client I can set users and groups permissions.

Up to now, Samba just maps to POSIX ACL's rwx permissions, which prevents me from using "Modify" or "Full Control" permissions on Windows. I also read a few things about xattrs and ZFS ACL support.

Can someone give a hint on what is the best way to go beyond POSIX ACLs to completely resemble Windows ACEs?


Source: (StackOverflow)

Samba configuration for public shares

yesterday I upgraded my fedora box to the latest version, and with that, I also upgraded samba, now using samba 4. I used to access those share from any computer at home without user/password, but now there seems to be something wrong with the configuration.

Here is my smb.conf

[global]
    workgroup = mygroup
    server string = Samba Server Version %v
    netbios name = HOME-WS
    log file = /var/log/samba/log.%m
    max log size = 50
    guest ok = yes
    security = share

[Media]
    path = /mnt/Media
    read only = yes
    browseable = yes
    guest ok = yes
    guest only = yes

[Music]
    path = /mnt/Music
    read only = yes
    browseable = yes
    guest ok = yes
    guest only = yes

Looking at the logs, there is a warning related to the security parameter

 WARNING: Ignoring invalid value 'share' for parameter 'security'

Does that means that samba 4 has finally removed 'share' as an option, is there any alternative to it, so that I can configure shares without passwords.


Source: (StackOverflow)

NAS Performance: NFS vs Samba vs GlusterFS

I am planning my new shared storage infrastructure for a small webserver farm. Therefore i ran a lot of tests with a lot of NAS filesystems. By doing so, i got some unexpected results and would like to know whether somebody here can confirm this.

In short: Samba is hugely faster than NFS and GlusterFS for small file writes.

Here what i did: I ran a simple "rsync benchmark" with a lot of files to compare the write performance for small files. For easier reproduction, i re-ran it just now with the contents of the current wordpress tar.gz.

  • GlusterFS replicated 2: 32-35 seconds, high CPU load
  • GlusterFS single: 14-16 seconds, high CPU load
  • GlusterFS + NFS client: 16-19 seconds, high CPU load
  • NFS kernel server + NFS client (sync): 32-36 seconds, very low CPU load
  • NFS kernel server + NFS client (async): 3-4 seconds, very low CPU load
  • Samba: 4-7 seconds, medium CPU load
  • Direct disk: < 1 second

I am absolutely no samba guru (i think my last contact was with samba 2.x), so i did not optimize anything here - just out-of-the-box config (debian/squeeze package). The only thing i added "sync always = yes" which is supposed to enforce sync after write (but seeing those results..). Without it, the tests where about 1-2 seconds faster.

All the tests where run on the same machine (self-mounted it's NAS export), so no network delays - pure protocol performance.

Side node: As file system i used ext4 and xfs. The above results are with ext4. xfs performed up to 40% (less time) better. The machines are EC2 m1.small instances. NAS export are on EBS volumes, sources (extracted tar) on ephemeral disk.

So here we go: Can anybody explain to me why samba is so much faster?

Also: Is NFS performance with the kernel server supposed to be that horrible (outperformed by the GlusterFS NFS server) in sync mode? Any idea how to tune this?

Thanks, L


Source: (StackOverflow)

Directories shown as files, when sharing a mounted cifs drive

I have an issue where a directory is shown as a file when accessing a samba share ( on Ubuntu 12.10 ) from a Windows machine.

The output from ls -ll in the folder on the linuxbox is as follows:

chubby@chubby:/media/blackhole/_Arkiv$ ls -ll
total 0
drwxrwxrwx 0 jv users 0 Jun 18  2012 _20
drwxrwxrwx 0 jv users 0 Apr 17  2012 _2006
drwxrwxrwx 0 jv users 0 Apr 17  2012 _2007
drwxrwxrwx 0 jv users 0 May 12  2011 _2008
drwxrwxrwx 0 jv users 0 Feb 19 09:53 _2009
drwxrwxrwx 0 jv users 0 Dec 20  2011 _2010
drwxrwxrwx 0 jv users 0 May  8  2012 _2011
drwxrwxrwx 0 jv users 0 Mar  5 11:37 _2012
drwxrwxrwx 0 jv users 0 Feb 28 10:09 _2013
drwxrwxrwx 0 jv users 0 Feb 28 11:18 _Mailarkiv
drwxrwxrwx 0 jv users 0 Jan  3  2011 _Praktikanter

The entry in /etc/fstab is:

# Mounting blackhole
//192.168.0.50/kunder/ /media/blackhole cifs uid=jv,gid=users,credentials=/home/chubby/.smbcredentials,iocharset=utf8,file_mode=0777,dir_mode=0777 0 0

When I access the share directly from the NAS on my Windows box, there are no issues.

The version of Samba is 3.6.6, but I couldn't find anything in the changelogs that seem relevant.

I've tried mounting it in different locations with different permissions, users and groups but I have not made any progress

Due to my low reputation on serverfault ( mostly stackoverflow user ) I'm unable to post a screenshot that shows that the directories are shown as files.

If I type the full path in explorer, the directory listing works excellently, except for any subdirectories that are then shown as files.

Any attack vector for this issue would be greatly appreciated.

Please let me know if I have provided insufficient details.

Edit: The same share when accessed from a OS X, works perfectly listing the directories as directories. Best Regards!


Source: (StackOverflow)

Samba4 advice for production use

I have an old Samba 3 + LDAP server installed that needs to be rebuilt. I'm weighting my options, and Windows Server seems too expensive at the moment, and Samba 4 appeared to be a nice option, coupled with the last Bind 9 that can dynamically add the computers to the DNS.

I have about 30 workstations, so I still consider it a small network.

My questions are:

  1. Is Samba 4 stable enough for production? It seems as if the Samba team is too cautious on when to call their version final, or even beta, as compared with other open source projects.
  2. What Linux distribution would you recommend to set it up? I usually use Ubuntu Server, but may use another one if installing / maintaining Samba 4 is better on that one.

Source: (StackOverflow)

How to setup samba share to be mounted as specific user?

I want to create samba share to which users can connect as specific samba user. I created user, let's say henry, and I want to make storage in his home.

So I have in my /etc/samba/smb.conf:

[myshare]
  path = /home/henry
  browsable = yes
  read only = no
  guest ok = no
  create mask = 0644

Now when I connect by smbclient everything is fine. But I want to mount this share as CIFS. I can do:

sudo mount -t cifs //myserver/myshare /media/remote-share -o user=henry

But then when I try to create a file in /media/remote-share, I get permission denied :(

How should I configure it if I want everybody to have access there, but as specific user, not as guest?

Both server and client are ubuntu machines.


Source: (StackOverflow)

How can I clear the "authentication cache" in Windows 7 to a password protected samba share?

I have a Linux samba server and have explicitly listed users that can access the folder.

I have successfully congfigured Samba to require a username and password when accessing the share from windows (using the smbpasswd, etc.).

But now I want to force clear the auth cache on the windows machine. Such as when I go to a colleague's computer, I use my account to access a file in the protected share, but then before I leave his computer, i'll want to make sure the authorization cache is cleared so he cannot access that folder with my credentials.

I found the command to use in the windows command prompt on google a couple of weeks ago but silly me I didn't save it...

Hope someone can help, thanks!

Oh, Samba is configured as a workgroup and not a domain (if that helps) - so windows users do NOT log into a domain on start up.


Source: (StackOverflow)

Reset Domain Trust with workstations from Samba 3.x server

I am having issues on a network I inherited with a Samba 3 server acting as the domain controller, and many, but not all, Windows 7 Pro PCs. The issues described here and here do not solve my issue.

On boot up, on some PCs, I get an error message saying The trust relationship between this workstation and the domain controller has failed. My Google searches explain to remove/re-add the machine from the domain, and this requires manual intervention, and sometimes doesn't work. What I have been doing, since this is intermittent, even with systems that are currently logging in OK, is to run the following command from an Elevated Command Prompt on each PC: echo 192.168.0.3 smb > c:\windows\system32\drivers\etc\lmhosts. I then reboot, and the error stays away then.

The weird thing is that once in a while, it just assumes my server is at a different IP address. The computers sometimes think that the SMB server is 192.168.0.1 instead of 192.168.0.3. I can verify this, because when I do net use \\smb, I get a Network name not found, but I can ping it and get the right address. When I do a new view \\smb, it would go to the old server (which is now 192.168.0.1, never had this name though). Doing a net view \\192.168.0.3 would show the correct server, then let me login to Windows just the one time, until reboot.

My issue is that I need to figure out why this is happening, so I do not need to touch every PC. It's a fast fix, once everything loads, but is not ideal. Below is the output of my testparm command on the Primary Domain Controller:

Load smb config files from /etc/samba/smb.conf
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
Processing section "[netlogon]"
Processing section "[homes]"
Processing section "[Programs]"
Processing section "[Login]"
Processing section "[Windsor]"
Processing section "[Office]"
Processing section "[Admin]"
Processing section "[Student_Share]"
Processing section "[Tech_Tips]"
Processing section "[Tech_Apps]"
Processing section "[DropBox]"
Processing section "[SSS]"
Processing section "[JMC]"
Processing section "[DRC]"
Processing section "[FASD]"
Processing section "[CLA]"
Processing section "[YAPS]"
Processing section "[IMAGES]"
Processing section "[Printer_Drivers]"
Processing section "[Self_Serve]"
Loaded services file OK.
WARNING: You have some share names that are longer than 12 characters.
These may not be accessible to some older clients.
(Eg. Windows9x, WindowsMe, and smbclient prior to Samba 3.0.)
Server role: ROLE_DOMAIN_PDC

All of the shares are OK. The time on each workstation is matched up with the domain controller (NET TIME \\SMB /SET /Y in the startup script), and I can log in as the Local Administrator only. What can I look for on my Samba server to not require this weird workaround?


Source: (StackOverflow)

Best way to mount a Linux filesystem on Windows over the Internet?

I was going to attempt Samba over SSH, any better ideas?

Edit: My mom has been bugging me to do some offsite backing up of her files. She currently uses Norton Ghost. I have a VPS that I use for some other stuff and I figured that I could just setup a FTP server and let Norton connect to that for some offsite backing up action. But for some unknown reason, Norton doesn't handle SFTP or FTPS, so I have to figure out how to automatically mount a Linux drive on Windows or get Norton working with SFTP.

Edit: Thanks for all your help guys (girls?)!


Source: (StackOverflow)

Trying to rename a file via Samba; fails if there is a '2' in the filename

This seems a bizarre issue, hope someone might shed some light. I set up some samba folders on a couple of ubuntu servers for the users to do some file management. After moving a file into the share, the user is trying to rename the file from their windows XP computer through samba, but getting the error "The file name you specified is not valid or too long. Specify a different file name."

I checked the permissions and messed around with it from Windows 7 and am having the same issue. Ultimately I found that I can change the filename as long as the new name does not include the number '2'. The new name of the file should be '285870_full' and we can name it '185870_full' and '385870_full' and anything else I can think to try, but '285870_full' gives the error about "filename you specified is not valid or too long"

I connected to the server via SSH and was able to rename the file that way without any error. Now through samba I can see the file is named '285870_full' and if I try to add another '2' it gives the same error but otherwise I can rename it normally.

I tried with another random small text file and have the same issue - it won't let me rename it to anything with a '2' in the new name, but '134567890' works fine. Any ideas?

Update: I set log level to 3 and here is the relevant portion of the log from a test;

reply_mv : pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_p22.txt
[2013/07/22 21:58:39, 3] smbd/reply.c:5981(rename_internals) rename_internals: case_sensitive = 0, case_preserve = 1, short case preserve = 1, directory = pending/31345678901affiliate_pixel33.txt, newname = pending/31345678901affiliate_p22.txt, last_component_dest = 31345678901affiliate_p22.txt
[2013/07/22 21:58:39, 3] smbd/dosmode.c:149(unix_mode) unix_mode(pending/31345678901affiliate_pixel33.txt) returning 0744
[2013/07/22 21:58:39, 2] smbd/open.c:580(open_file) root opened file pending/31345678901affiliate_pixel33.txt read=No write=No (numopen=1)
[2013/07/22 21:58:39, 2] smbd/close.c:612(close_normal_file) root closed file pending/31345678901affiliate_pixel33.txt (numopen=0) NT_STATUS_OK
[2013/07/22 21:58:39, 3] smbd/reply.c:6041(rename_internals) rename_internals: Error NT_STATUS_OBJECT_NAME_INVALID rename pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_p22.txt
[2013/07/22 21:58:39, 3] smbd/error.c:60(error_packet_set) error packet at smbd/reply.c(6273) cmd=7 (SMBmv) NT_STATUS_OBJECT_NAME_INVALID
[2013/07/22 21:58:39, 3] smbd/process.c:1459(process_smb) Transaction 14 of length 162 (0 toread)
[2013/07/22 21:58:39, 3] smbd/process.c:1273(switch_message) switch message SMBtrans2 (pid 11644) conn 0x7fad01371210

I see renaming with a '2' gives NT_STATUS_OBJECT_NAME_INVALID ?

Here is another log snip while it successfully renamed to something without a '2'

[2013/07/22 22:05:33, 3] smbd/reply.c:6263(reply_mv) reply_mv : pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_44.txt
[2013/07/22 22:05:33, 3] smbd/reply.c:5981(rename_internals) rename_internals: case_sensitive = 0, case_preserve = 1, short case preserve = 1, directory = pending/31345678901affiliate_pixel33.txt, newname = pending/31345678901affiliate_44.txt, last_component_dest = 31345678901affiliate_44.txt
[2013/07/22 22:05:33, 3] smbd/dosmode.c:149(unix_mode) unix_mode(pending/31345678901affiliate_pixel33.txt) returning 0744
[2013/07/22 22:05:33, 2] smbd/open.c:580(open_file) root opened file pending/31345678901affiliate_pixel33.txt read=No write=No (numopen=1)
[2013/07/22 22:05:33, 3] smbd/reply.c:5816(rename_internals_fsp) rename_internals_fsp: succeeded doing rename on pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_44.txt
[2013/07/22 22:05:33, 2] smbd/close.c:612(close_normal_file) root closed file pending/31345678901affiliate_44.txt (numopen=0) NT_STATUS_OK
[2013/07/22 22:05:33, 3] smbd/reply.c:6041(rename_internals) rename_internals: Error NT_STATUS_OK rename pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_44.txt
[2013/07/22 22:05:33, 3] smbd/process.c:1459(process_smb) Transaction 72 of length 158 (0 toread)

So I wonder why a '2' gives NT_STATUS_OBJECT_NAME_INVALID ?


Source: (StackOverflow)