0

I'm trying to restart openssh-server in Ubuntu 10.10 by typing:

sudo /etc/init.d/ssh restart

and I'm getting this error:

sudo: unable to execute /etc/init.d/ssh: Text file busy
1
  • What does ls -l /etc/init.d/ssh say? Also, is it sudo itself that's having the problem? Try running some other command with sudo and see if you get the same error message
    – DerfK
    Oct 23, 2010 at 14:18

4 Answers 4

0

I don't know if it'll make any difference, but Ubuntu's had start and stop service control for a while. E.g:

start ssh
stop ssh

start <service-name-here>
0
1

It sounds like you might have the file /etc/init.d/ssh open for writing somewhere, and therefore can't execute it. See this answer.

What does

ps -f -p $(pgrep -f -d, '/etc/init.d/ssh')

get you?

1
  • ERROR: List of process IDs must follow -p. Oct 23, 2010 at 15:39
0

You can do a

sudo killall sshd

then restart it with

sudo service sshd start
3
  • hmmm... the killall seemed to work, but the start command says "unrecognized service" Oct 23, 2010 at 12:22
  • oh, and even after killall I can still ssh in. I'm terribly confused. Oct 23, 2010 at 12:24
  • When you do a ps -ef|grep ssh what do you see?
    – hfranco
    Nov 23, 2010 at 17:33
0

I'm not sure it's also true on Ubuntu but on Debian, you can properly restart your openssh server without using init.d file with:

# start-stop-daemon --stop --signal 1 --quiet --oknodo --pidfile /var/run/sshd.pid --exec /usr/sbin/sshd

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .