Results 1 to 4 of 4

Thread: Auto mount SSHFS with Expect HELP NEED :(

  1. #1
    Join Date
    Aug 2009
    Location
    India, Tamilnadu
    Beans
    206
    Distro
    Kubuntu 15.10 Wily Werewolf

    Question Auto mount SSHFS with Expect HELP NEED :(

    Hi all,

    I am new to bash and expect.

    Now I have a expect script:
    Code:
    #!/usr/bin/expect -f
    set HOST "server"
    set USER "roxsoft"
    set PASS "***"
    set PATH "/home/roxsoft/www/"
    spawn sshfs "$USER@$HOST:"  "/media/server-ssh"
    expect "Are you sure you want to continue connecting (yes/no)? yes" 
    send "yes\r" 
    expect "roxsoft@server's password:"
    send "$PASS\r"
    exit
    When I run this script I got:
    Code:
    :$ ~/server-ssh.sh
    spawn sshfs roxsoft@server: /media/server-ssh
    Warning: the DSA host key for 'server' differs from the key for the IP address '169.254.43.84'
    Offending key for IP in /home/roxsoft-server/.ssh/known_hosts:1
    Matching host key in /home/roxsoft-server/.ssh/known_hosts:2
    Are you sure you want to continue connecting (yes/no)? yes
    roxsoft@server's password: :$

    The problem is:
    sometimes I can't access /media/server-ssh directory after running this script.
    sometimes I can access /media/server-ssh but I can see only empty folder... (ie: server folder was not mounted...)

    If I run this manually I got everything working fine..
    Code:
    sshfs "USERNAME@$__IP__:"  "/media/server-ssh"

    Whats wrong with this?????

  2. #2
    Join Date
    Aug 2009
    Location
    India, Tamilnadu
    Beans
    206
    Distro
    Kubuntu 15.10 Wily Werewolf

    Re: Auto mount SSHFS with Expect HELP NEED :(

    >50 views... But no reply .... .
    Kindly ask me if any more information is required, regarding question

  3. #3
    Join Date
    Nov 2009
    Location
    The Netherlands
    Beans
    239
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: Auto mount SSHFS with Expect HELP NEED :(

    My guess would be that you should remove the last yes from this line
    Code:
    expect "Are you sure you want to continue connecting (yes/no)? yes"
    But it would probably be a better idea to fix your keys so you don't have to enter a password at login. Having a password in a plaintext file or script is never a good idea.

  4. #4
    Join Date
    Aug 2009
    Location
    India, Tamilnadu
    Beans
    206
    Distro
    Kubuntu 15.10 Wily Werewolf

    Re: Auto mount SSHFS with Expect HELP NEED :(

    Thanks ziekfiguur

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •