published on in gacor

How to list SAMBA share users

I have a linux server and a Windows server. On Linux was installed and configured Samba to share 2 directories to the windows server. In /etc/samba/smb.conf we have:

[Myapp PDF Reports] comment = Reports browseable = yes path = /var/www/myapp/reports_pdf printable = no guest ok = no read only = no create mask = 0700 [Myapp PDF Vault] comment = PDF Vault browseable = yes path = /var/www/myapp/PDFvault printable = no guest ok = no read only = no create mask = 0700 

In windows I see the 2 shares under the linux server, but I don't know which user I have to use to connect to them (unfortunatly I can't ask to the person implemented them some years ago). How can I see in Linux r Windows which is the user with the right permission to access these 2 shares and then get the relative password?

Kind regards, Matteo

2 Answers

If you login to the Samba server, you can run the following command to list valid Samba users:

sudo pdbedit -L -v 

The above command will list users known to Samba - this is not the same as the users and passwords known the Linux server it is running on. Read that last sentence again.

If you don't know the passwords for the old users, you have a couple of choices:

  • change the password of an old, existing user to something new, or
  • add a new user with a new password that you can use.

I think the first option is less desirable because it means if there are clients that know the old password and you change it, they will suddenly stop working.

So, I would add a new Samba user. This new user must have a login name on the Samba server, so either choose an existing Linux username you want to use, or add a new one. Here's a way to add a user called samba:

  • add samba as a regular user with a regular Linux login
  • add samba as a Samba user
  • set the Samba password for samba
  • use those credentials when mounting a Samba share

That looks like:

sudo adduser samba # add a regular Linux user sudo smbpasswd -a samba # add Samba user called `samba` sudo smbpasswd -e samba # enable - may not be needed 

Now you should be able to mount the shares with username=samba and the password you just set.

4

Do not give the user 'nobody' a Samba password. The user 'nobody' is used with 'map to guest = bad user' in the global section of smb.conf and with 'guest ok = yes' in a share. If these are set, then Samba will map any unknown users to the guest user and all files created on the share will belong to nobody:nogroup.

If you need to create a new user, you must first create a Linux user and then make that user a Samba user with 'smbpasswd -a username' run as root, where 'username' is the name of the Linux user you just created.

1

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobmxxZ2V%2Fcn2OoaawZaSkeq210q1krJmdl65uv8eaqZ5lpaiys78%3D