I am trying to use "apt-get" to install a software called "expect" via cmd with ssh:

ssh -t root@111.111.111 'apt-get install -v -y expect'

However, this is what I get:

apt 1.0.1ubuntu2 for amd64 compiled on Aug  1 2015 19:20:48
Supported modules:
*Ver: Standard .deb
*Pkg:  Debian dpkg interface (Priority 30)
 Pkg:  Debian APT solver interface (Priority -1000)
 S.L: 'deb' Standard Debian binary tree
 S.L: 'deb-src' Standard Debian source tree
 Idx: Debian Source Index
 Idx: Debian Package Index
 Idx: Debian Translation Index
 Idx: Debian dpkg status file
 Idx: EDSP scenario file

And the software is not installed.

My question is: can or can't we use apt-get via ssh like above?

** By the way, yes, I can normally log in via ssh and install the software via ssh. **

closed as off-topic by Gilles, G-Man, Archemar, Bananguin, Anthon Oct 8 '15 at 7:31

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions describing a problem that can't be reproduced and seemingly went away on its own (or went away when a typo was fixed) are off-topic as they are unlikely to help future readers." – Gilles, G-Man, Archemar, Anthon
If this question can be reworded to fit the rules in the help center, please edit the question.

  • @roaima, The intention is not to automate login. It's just an experiment. By the way, I took off the login part from the question. – Roger Oct 7 '15 at 22:14
  • To be more accurate, search the web or your man pages about ssh-agent & ssh-add – Gilles Quenot Oct 7 '15 at 22:14
  • @Gilles Quenot, I took off the login automation from the question. – Roger Oct 7 '15 at 22:17
  • You say, "I can normally log in via ssh and install the software via ssh.", but you didn't log in via ssh and install the software with the command apt-get install -v -y expect? – G-Man Oct 8 '15 at 1:48
  • I am not aware of any common distribution that puts restrictions on commands depending on whether they are run locally or through ssh ... actually that would be pretty difficult to enforce. Therefore the answer is: "yes, you can use apt-get via ssh as shown above". You actually did it. – Bananguin Oct 8 '15 at 7:14

According to the man page for apt-get the -v flag simply prints the version of apt-get. So no software will be installed.

Run this instead

ssh -t root@111.111.111 'apt-get install -y expect'
  • 2
    I promise I saw the "-v" meant "verbose; thank you! – Roger Oct 7 '15 at 22:23

Not the answer you're looking for? Browse other questions tagged or ask your own question.