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
binaryorganic
  • 6,021
  • 4
  • 18
  • 19
  • 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 '10 at 14:18

4 Answers4

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?

Xhantar
  • 1,042
  • 1
  • 8
  • 11
0

You can do a

sudo killall sshd

then restart it with

sudo service sshd start
hfranco
  • 585
  • 2
  • 9
  • 25
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>
Azz
  • 320
  • 1
  • 3
  • 10
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