로그인 회원가입
모두인포
전체IT경제사회생활스포츠시사여행연애

centos sshfs python 패스워드 자동 입력 스크립트

lmkfox · 2021-02-21 · 조회 0
centos sshfs python 패스워드 자동 입력 스크립트
#! /usr/bin/python import pexpect import time username = "계정" password = "패스워드" host = "IP " hostdirectory = "호스트" mountpoint = "마운트 될 장소 " option = "-o allow_other -o nonempty" command = "sshfs " + username + "@" + host + ":" + hostdirectory + " " + mountpoint + " " + option def start_sshfs():     try:         sshfs = pexpect.spawn(command)         sshfs.expect(username + "@" + host + "'s password: ")         time.sleep (0.1)         sshfs.sendline (password)         time.sleep (10)         sshfs.expect (pexpect.EOF)     except Exception, e:         print str(e) def main ():     start_sshfs() if __name__ == '__main__':     main ()

댓글

아직 댓글이 없습니다.

로그인 후 댓글을 남길 수 있습니다.