SMBクライアントにパスワードが必要です

SMBクライアントにパスワードが必要です

次のコマンドを使用してSamba共有に接続しています。

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

接続する前にLinuxアカウントのパスワードを要求しました。

手動で実行しても問題はありませんが、パスワードを要求せずにbashスクリプトでどのように使用しますか?

ベストアンサー1

可能でなければなりません。
からman smbclient

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

したがって、次のようなものを使用できます。

/usr/bin/smbclient \\\\server78\\publicfolder -U=user%password

おすすめ記事