使用脚本输入密码。Bash&;|python
我正在尝试创建一个脚本,以便在Linux中装载一系列webDAV文件夹 现在,在执行以下操作时,这是可能的:使用脚本输入密码。Bash&;|python,python,bash,echo,webdav,Python,Bash,Echo,Webdav,我正在尝试创建一个脚本,以便在Linux中装载一系列webDAV文件夹 现在,在执行以下操作时,这是可能的: sudo mount -t davfs -o noexec http://dav.website.com /mnt/ 问题是,一旦执行命令,用户就会被要求输入凭据 enter username: enter password: 现在,我对整个在线DAV文件夹系列使用了相同的密码和用户名 我有没有办法编写bash或bash嵌入式python脚本 我试过以下方法 sudo mount
sudo mount -t davfs -o noexec http://dav.website.com /mnt/
问题是,一旦执行命令,用户就会被要求输入凭据
enter username:
enter password:
现在,我对整个在线DAV文件夹系列使用了相同的密码和用户名
我有没有办法编写bash或bash嵌入式python脚本
我试过以下方法
sudo mount -t davfs -o noexec http://dav.website.com /mnt/ |echo username\npassowrd
,但没有成功
我真的得用这个
sudo mount -t davfs -o noexec http://dav.website.com /mnt/
方法。带有:
sudo mount-t davfs-o noexechttp://dav.website.com /mnt/看看expect,它是为这类事情而设计的。
sudo mount -t davfs -o noexec http://dav.website.com /mnt/ << EOF
username
password
EOF