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
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>
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?
You can do a
sudo killall sshd
then restart it with
sudo service sshd start
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
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