Default username for Samba share that is not the user name on the client system
You might be using share-level security (security = share) in your smb.conf
file. In share-level security, Samba uses the share name as the username for the connection and does not ask for a username in the protocol. This is basically how Window 98 worked. You probably want security = user and you will need a proper smbpasswd
file as well as Samba can't use the normal UNIX password database (/etc/passwd
or /etc/shadow
). Use smbpasswd -a lfm
to add a new user for lfm and set it's password, set security = user in smb.conf
and restart Samba.
Related videos on Youtube
![CW Holeman II](https://i.stack.imgur.com/37gU2.jpg?s=256&g=1)
CW Holeman II
You may have just discovered a dozen VMS posts today, but up voting them together causes all of the votes to be deleted. C++17 and XSLT: Aptcp C++ and I18N: Ask Library (C++) Perl, Javascript, XUL: Stevedore - DocWorker JavaScript, SVG, DOM, XML and XSLT: Emle - Electronic Mathematics Laboratory Equipment documentation VAX FORTRAN: SDSU_AskLib VMS, VAXELN, RSX-11M/M+, C, DCL, TCL/Tk, Scala OpenHub/cwhii Resume Windows NT looks like MS-Windows with features from VMS but in its heart it is like VAXELN...ZuckOS
Updated on September 17, 2022Comments
-
CW Holeman II almost 2 years
When mounting a Samba share the user name is defaulting to the user name from the client machine rather than the "User Name" field from the earlier "Connect to Server" dialogue.
Accessing a Samba share over ssh from Linux with Nautilus where the client user name is "lfm" and the user name on the server system is "lastfirstmiddle":
$ who | awk '{print $1}' lfm lfm $ sudo ssh [email protected] -L 445:samba.example.com:445 -L 139:samba.example.com:139 -f -N [sudo] password for lfm: [email protected]'s password: $ nautilus
The user home share does not exhibit the problem. The password dialog is using the user name as specified in the "Connect to Server" dialogue as expected:
lfm - File Brower Location: [/home/lfm] File>Connect To Server...> Connect To Server Service type: [Windows Share] Server: [localhost] Share: [lastfirstmiddle] User Name: [lastfirstmiddle] Domain Name: [example-com] <Connect> Password required for share lastfirstmiddle on localhost [x]Forget password immediately Password: [*******] <Connect> lastfirstmiddle on localhost - File Browser Location: [smb://example-com;lastfirstmiddle@localhost/lastfirstmiddle/]
Using the "Connect to Server" dialogue one can get a list of "Windows Shares" by leaving the "Share" field blank.
lastfirstmiddle on localhost - File Browser File>Connect To Server...> Connect To Server Service type: [Windows Share] Server: [localhost] Share: [] User Name: [lastfirstmiddle] Domain Name: [example-com] <Connect> Password required for share lastfirstmiddle on localhost [x]Forget password immediately Password: [*******] <Connect> On localhost - File Brower Location: [smb://localhost/]
Then select a share and "Open with Open Folder" produces the "Connect to Server" dialog which unlike the previous case defaults the "User name" to the user on the client system. It does not pick up the value used in the "Connect to Server" dialogue that produced the list of shares.
On localhost - File Brower Location: [smb://localhost/] ----------- ---- ---- ----- Name Size Type Date ----------- ---- ---- ----- AShare -- Folder Unkown BShare -- Folder Unkown CShare -- Folder Unkown {{XShare -- Folder Unkown}} YShare -- Folder Unkown ZShare -- Folder Unkown File>Open with Open Folder>
One can use "Connect to Server" and specify a "Bookmark" which can be used later to mount a share without having to compete the "Connect to Server" dialog each time. To have access to all six shares listed above (ABCXYZ) one would need to create six bookmarks. This might be OK for six shares but if there are dozens of shares this would be a bit obnoxious.
Is there a way to change the default user name to something other than the client system's user name?
-
Admin about 13 yearsAny luck getting it to work?
-