Locked out of Vagrant box by bad .bashrc. Can I use Vagrantfile to get back in?
I have a vagrant box running under the default user vagrant. I access the shell with Putty and a keyfile. I'm on Windows.
I added this command to the end of .bashrc
if [[ ! $TERM =~ screen ]]; then
exec tmux
fi
in an effort to start tmux automatically when I started a session.
But now the shell exits after it loads tmux. I don't get a chance to do anything before it exits.
I've been taking advice on Reddit https://www.reddit.com/r/linuxquestions/comments/ahvdwn/locked_out_of_shell_by_command_in_bashrc_can_i/
So I've tried a lot of things from the logging in side of things but nothing is working.
So my question here is can I use the Vagrantfile to gain access to the box through an alternative configuration? Can I bypass the box's internal setup which is password access turned off, no root access, ssh keyed access for the vagrant user, no ftp (only sftp which uses the secured user).
vagrant
migrated from serverfault.com Jan 21 at 14:56
This question came from our site for system and network administrators.
add a comment |
I have a vagrant box running under the default user vagrant. I access the shell with Putty and a keyfile. I'm on Windows.
I added this command to the end of .bashrc
if [[ ! $TERM =~ screen ]]; then
exec tmux
fi
in an effort to start tmux automatically when I started a session.
But now the shell exits after it loads tmux. I don't get a chance to do anything before it exits.
I've been taking advice on Reddit https://www.reddit.com/r/linuxquestions/comments/ahvdwn/locked_out_of_shell_by_command_in_bashrc_can_i/
So I've tried a lot of things from the logging in side of things but nothing is working.
So my question here is can I use the Vagrantfile to gain access to the box through an alternative configuration? Can I bypass the box's internal setup which is password access turned off, no root access, ssh keyed access for the vagrant user, no ftp (only sftp which uses the secured user).
vagrant
migrated from serverfault.com Jan 21 at 14:56
This question came from our site for system and network administrators.
add a comment |
I have a vagrant box running under the default user vagrant. I access the shell with Putty and a keyfile. I'm on Windows.
I added this command to the end of .bashrc
if [[ ! $TERM =~ screen ]]; then
exec tmux
fi
in an effort to start tmux automatically when I started a session.
But now the shell exits after it loads tmux. I don't get a chance to do anything before it exits.
I've been taking advice on Reddit https://www.reddit.com/r/linuxquestions/comments/ahvdwn/locked_out_of_shell_by_command_in_bashrc_can_i/
So I've tried a lot of things from the logging in side of things but nothing is working.
So my question here is can I use the Vagrantfile to gain access to the box through an alternative configuration? Can I bypass the box's internal setup which is password access turned off, no root access, ssh keyed access for the vagrant user, no ftp (only sftp which uses the secured user).
vagrant
I have a vagrant box running under the default user vagrant. I access the shell with Putty and a keyfile. I'm on Windows.
I added this command to the end of .bashrc
if [[ ! $TERM =~ screen ]]; then
exec tmux
fi
in an effort to start tmux automatically when I started a session.
But now the shell exits after it loads tmux. I don't get a chance to do anything before it exits.
I've been taking advice on Reddit https://www.reddit.com/r/linuxquestions/comments/ahvdwn/locked_out_of_shell_by_command_in_bashrc_can_i/
So I've tried a lot of things from the logging in side of things but nothing is working.
So my question here is can I use the Vagrantfile to gain access to the box through an alternative configuration? Can I bypass the box's internal setup which is password access turned off, no root access, ssh keyed access for the vagrant user, no ftp (only sftp which uses the secured user).
vagrant
vagrant
asked Jan 21 at 1:38
mos fetishmos fetish
1061
1061
migrated from serverfault.com Jan 21 at 14:56
This question came from our site for system and network administrators.
migrated from serverfault.com Jan 21 at 14:56
This question came from our site for system and network administrators.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Under Linux, the commands below would have granted access :
vagrant ssh-config > my_ssh_config
ssh -q -F my_ssh_config vagrant@broken-host '/bin/bash --norc --noprofile'
On Windows, I suppose that you have to use plink.exe to achieve something similar. Good luck.
As per the advice given on Reddit (link above), attempts of that nature resulted in "open terminal failed: not a terminal" error. In all attempts, ,bashrc loads, loads tmux per the above code, and immediately exits dropping the connection. --norc has zero effect
– mos fetish
Jan 21 at 20:01
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396652%2flocked-out-of-vagrant-box-by-bad-bashrc-can-i-use-vagrantfile-to-get-back-in%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Under Linux, the commands below would have granted access :
vagrant ssh-config > my_ssh_config
ssh -q -F my_ssh_config vagrant@broken-host '/bin/bash --norc --noprofile'
On Windows, I suppose that you have to use plink.exe to achieve something similar. Good luck.
As per the advice given on Reddit (link above), attempts of that nature resulted in "open terminal failed: not a terminal" error. In all attempts, ,bashrc loads, loads tmux per the above code, and immediately exits dropping the connection. --norc has zero effect
– mos fetish
Jan 21 at 20:01
add a comment |
Under Linux, the commands below would have granted access :
vagrant ssh-config > my_ssh_config
ssh -q -F my_ssh_config vagrant@broken-host '/bin/bash --norc --noprofile'
On Windows, I suppose that you have to use plink.exe to achieve something similar. Good luck.
As per the advice given on Reddit (link above), attempts of that nature resulted in "open terminal failed: not a terminal" error. In all attempts, ,bashrc loads, loads tmux per the above code, and immediately exits dropping the connection. --norc has zero effect
– mos fetish
Jan 21 at 20:01
add a comment |
Under Linux, the commands below would have granted access :
vagrant ssh-config > my_ssh_config
ssh -q -F my_ssh_config vagrant@broken-host '/bin/bash --norc --noprofile'
On Windows, I suppose that you have to use plink.exe to achieve something similar. Good luck.
Under Linux, the commands below would have granted access :
vagrant ssh-config > my_ssh_config
ssh -q -F my_ssh_config vagrant@broken-host '/bin/bash --norc --noprofile'
On Windows, I suppose that you have to use plink.exe to achieve something similar. Good luck.
answered Jan 21 at 13:04
Chaoxiang NChaoxiang N
101
101
As per the advice given on Reddit (link above), attempts of that nature resulted in "open terminal failed: not a terminal" error. In all attempts, ,bashrc loads, loads tmux per the above code, and immediately exits dropping the connection. --norc has zero effect
– mos fetish
Jan 21 at 20:01
add a comment |
As per the advice given on Reddit (link above), attempts of that nature resulted in "open terminal failed: not a terminal" error. In all attempts, ,bashrc loads, loads tmux per the above code, and immediately exits dropping the connection. --norc has zero effect
– mos fetish
Jan 21 at 20:01
As per the advice given on Reddit (link above), attempts of that nature resulted in "open terminal failed: not a terminal" error. In all attempts, ,bashrc loads, loads tmux per the above code, and immediately exits dropping the connection. --norc has zero effect
– mos fetish
Jan 21 at 20:01
As per the advice given on Reddit (link above), attempts of that nature resulted in "open terminal failed: not a terminal" error. In all attempts, ,bashrc loads, loads tmux per the above code, and immediately exits dropping the connection. --norc has zero effect
– mos fetish
Jan 21 at 20:01
add a comment |
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1396652%2flocked-out-of-vagrant-box-by-bad-bashrc-can-i-use-vagrantfile-to-get-back-in%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown