Smbclient asking for password

37,665

It should be possible to do it.
From man smbclient :

  -U|--user=username[%password]
       Sets the SMB username or username and password.
       If %password is not specified, the user will be prompted.

So you could use something like :

/usr/bin/smbclient \\\\server78\\publicfolder -U=user%password
Share:
37,665

Related videos on Youtube

fightstarr20
Author by

fightstarr20

Boldly going.....

Updated on September 18, 2022

Comments

  • fightstarr20
    fightstarr20 over 1 year

    I am connecting to a samba share using the following command..

    /usr/bin/smbclient \\\\server78\\publicfolder
    

    It asks me for my linux account password before it will connect.

    This isn't a problem if I am running it manually but how can I use this within a bash script without it asking me for the password?

  • fightstarr20
    fightstarr20 almost 8 years
    But surely this is for setting the username and password for the samba share?
  • magor
    magor almost 8 years
    it is for providing the user and password for the samba share in order to access it
  • fightstarr20
    fightstarr20 almost 8 years
    That is not what the original question asks, it asks for the current linux user account password, not the samba share password
  • roaima
    roaima almost 8 years
    @fightstarr20 the username and password specified by the -U flag is the username and password required to access the share. Whether those credentials are Samba specific or your usual Linux credentials depends how the share has been defined on the server. If this is insufficient you'll need to update your question to include the [global] and [share]-specific sections of your smb.conf