简体   繁体   中英

delete remote file using ssh when ssh not working

on a remote server I have created a file in /etc/profile.d/x.sh with content

#!/bin/bash

exit 1

now I am unable to ssh to the remote server. unfortunately ssh was the only way to connect.

ssh root@remoteserver
Password:
Last login: Fri Nov 21 18:32:47 2014 from 10.62.95.12
Connection to remoteserver closed.

I have tried

ssh root@10.62.95.130 rm -f /etc/profile.d/x.sh
Password:

but this did not work. Is there any way to delete the file using ssh. Or instruct ssh to continue on error.

Try — ssh root@server sh and then rm /etc/profile.d/x.sh

Though ssh root@server rm /etc/profile.d/x.sh works for me too.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM