2016-10-26 4 views
-1

ユーザがCIFS共有をマウントできるようにするsystemdサービスを設定しようとしています。これは私が得たものである:Systemd service ask password

mount_cifs @

[Unit] 
Description=Mount CIFS share by %i 
After=network-online.target 
Wants=network-online.target 

[Service] 
Type=oneshot 
RemainAfterExit=yes 
ExecStartPre=/bin/mkdir -p /mnt/dir 
ExecStart=/bin/mount -t cifs //remote/path /mnt/dir -o username=%i 
ExecStop=/bin/umount /mnt/dir 
ExecStopPost=/bin/rmdir /mnt/dir 
しかし

、私はsystemctl start [email protected]実行したときに、私は次のメッセージを取得 .service:

Password for [email protected]//remote/path: 
Broadcast message from [email protected] (Wed 2016-10-26 21:24:56 CEST): 

Password entry required for 'Password for [email protected]//remote/path:' (PID 5677). 
Please enter password with the systemd-tty-ask-password-agent tool! 
私が使用することが出来るのですか正確に

このツール?

+0

systemd-tty-ask-password-agentツールのドキュメントを参照した後、どのように使用するのですか? –

+0

私は[documentation](https://www.freedesktop.org/software/systemd/man/systemd-tty-ask-password-agent.html)を読んだことがありますが、どのコマンドを使用する必要があるのか​​分かりませんユーザにパスワードを促す。 'systemd-tty-ask-password-agent'(+オプション)を入力しても大したことはありません... – gncs

+0

[システムとパスワードのプロンプトに関するネットワークに関する関連Q&A]を読んでいますか?(http://stackexchange.com/search ?q = systemd + passwords)、特にこれは[システム起動時にパスワードを要求する](http://unix.stackexchange.com/questions/77769/prompt-for-password-during-boot-with-systemd-service ) –

答えて

0

読んだ後、pwd=$(systemd-ask-password "Password:")が少なくとも1つの方法であることが判明しました。今すぐsystemdは不平を言っていません。