69
12
I'm using a GNU/Linux system remotely, via SSH.
I mistakenly added something into my $HOME/.bash_profile
scriot which causes an error. (To be specific: I added an exec foo
command instead of . foo
, applied to another bash script without execution permissions, which results in an error.)
Now I can't seem to SSH, SCP or SFTP into my machine: bash, my login shell, tries to run the exec foo
command, gets the error and throws me out! I don't have any other account I can access remotely.
Is there something I can do to restore access to the system?
Additional details:
- Most ports other than for SSH are unavailable since the machine is behind a firewall.
- It's a Devuan 3 ASCII (~= Debian 10 Beowulf) system.
Assuming this is your machine, so you know the root password, why not simply log in as root? – jamesqf – 2019-11-25T17:14:48.220
4
@jamesqf: That should really not be possible.
– einpoklum – 2019-11-25T18:24:45.9131The OP says it's his machine, so I would think he has physical access to it. If not, there surely must be a sysadmin or someone who can. Though I would think that this question ought to occasion a bit of thought about whether not allowing root logins via ssh is really that bad an idea :-) – jamesqf – 2019-11-26T04:38:28.553
4@jamesqf: I have physical access to the machine when I'm near it; now I'm remote. – einpoklum – 2019-11-26T08:11:43.053
2Physical access is nice and all; but it requires...well...physical access. Travel there, climb the tower, defeat the dra- sorry, got a bit carried away there. – Piskvor left the building – 2019-11-26T13:37:52.047
@jamesqf I don't think it suggests that permitting root logins via ssh is a good idea, but it might suggest that keeping an empty, backup, non-admin account that you can log into if you feck up your "main" account may be a good idea. Then you can
sudo
and do whatever you need to do to recover. This would have the same security as your "main" account, except that you have given an attacker an additional account to try breaking into, but given you'll be using keys I don't think this is a problem. – Lightness Races with Monica – 2019-11-26T20:07:56.597