Get back to default login shell after running /bin/bash
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
When logging in the prompt is different than it is after executing /bin/bash
-bash-4.2$ exec bash
bash-4.2$
How do I get the -
back in front of the bash. There are certain commands like tcp dump that only work in the orignal
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
Update for @ctrl-alt-delor
-bash-4.2$ groups
nuage
-bash-4.2$ exec bash
bash-4.2$ groups
nuage
update for @Mikel
bash-4.2$ exec bash -l
bash-4.2$
Update for @Mark Plotnick
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
[root@host nuage]# cat /etc/sudoers | grep nuage
[root@host nuage]# exit
bash-4.2$ group
bash-4.2$ groups
nuage
bash-4.2$ whoami
nuage
bash permissions tcpdump
 |Â
show 6 more comments
up vote
1
down vote
favorite
When logging in the prompt is different than it is after executing /bin/bash
-bash-4.2$ exec bash
bash-4.2$
How do I get the -
back in front of the bash. There are certain commands like tcp dump that only work in the orignal
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
Update for @ctrl-alt-delor
-bash-4.2$ groups
nuage
-bash-4.2$ exec bash
bash-4.2$ groups
nuage
update for @Mikel
bash-4.2$ exec bash -l
bash-4.2$
Update for @Mark Plotnick
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
[root@host nuage]# cat /etc/sudoers | grep nuage
[root@host nuage]# exit
bash-4.2$ group
bash-4.2$ groups
nuage
bash-4.2$ whoami
nuage
bash permissions tcpdump
Can you rungroups
before and after. Put the result in the question.
â ctrl-alt-delor
Jul 11 at 16:09
1
The-
just means it's a login shell. Tryexec bash -l
. I wonder if this is somehow related to SELinux or some other role-based access control system. But why are you doingexec bash
in the first place?
â Mikel
Jul 11 at 16:10
@Mikel Updated in original, this was the simplest form of the problem, the reason I need to find out how to run things as the original shell is because I must run a script and #!/bin/bash has different permissions than what was used to create the definition for the script.
â Xander May
Jul 11 at 17:21
Can you show us the output oftype tcpdump
before and after?
â Mark Plotnick
Jul 11 at 17:37
1
Tryexec -a -bash bash
; I think that ought to set things up so that your shell init files are read in by the new bash and thus you'll see all your aliases.
â Mark Plotnick
Jul 11 at 17:56
 |Â
show 6 more comments
up vote
1
down vote
favorite
up vote
1
down vote
favorite
When logging in the prompt is different than it is after executing /bin/bash
-bash-4.2$ exec bash
bash-4.2$
How do I get the -
back in front of the bash. There are certain commands like tcp dump that only work in the orignal
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
Update for @ctrl-alt-delor
-bash-4.2$ groups
nuage
-bash-4.2$ exec bash
bash-4.2$ groups
nuage
update for @Mikel
bash-4.2$ exec bash -l
bash-4.2$
Update for @Mark Plotnick
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
[root@host nuage]# cat /etc/sudoers | grep nuage
[root@host nuage]# exit
bash-4.2$ group
bash-4.2$ groups
nuage
bash-4.2$ whoami
nuage
bash permissions tcpdump
When logging in the prompt is different than it is after executing /bin/bash
-bash-4.2$ exec bash
bash-4.2$
How do I get the -
back in front of the bash. There are certain commands like tcp dump that only work in the orignal
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
Update for @ctrl-alt-delor
-bash-4.2$ groups
nuage
-bash-4.2$ exec bash
bash-4.2$ groups
nuage
update for @Mikel
bash-4.2$ exec bash -l
bash-4.2$
Update for @Mark Plotnick
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
[root@host nuage]# cat /etc/sudoers | grep nuage
[root@host nuage]# exit
bash-4.2$ group
bash-4.2$ groups
nuage
bash-4.2$ whoami
nuage
bash permissions tcpdump
edited Jul 11 at 17:47
asked Jul 11 at 15:29
Xander May
164
164
Can you rungroups
before and after. Put the result in the question.
â ctrl-alt-delor
Jul 11 at 16:09
1
The-
just means it's a login shell. Tryexec bash -l
. I wonder if this is somehow related to SELinux or some other role-based access control system. But why are you doingexec bash
in the first place?
â Mikel
Jul 11 at 16:10
@Mikel Updated in original, this was the simplest form of the problem, the reason I need to find out how to run things as the original shell is because I must run a script and #!/bin/bash has different permissions than what was used to create the definition for the script.
â Xander May
Jul 11 at 17:21
Can you show us the output oftype tcpdump
before and after?
â Mark Plotnick
Jul 11 at 17:37
1
Tryexec -a -bash bash
; I think that ought to set things up so that your shell init files are read in by the new bash and thus you'll see all your aliases.
â Mark Plotnick
Jul 11 at 17:56
 |Â
show 6 more comments
Can you rungroups
before and after. Put the result in the question.
â ctrl-alt-delor
Jul 11 at 16:09
1
The-
just means it's a login shell. Tryexec bash -l
. I wonder if this is somehow related to SELinux or some other role-based access control system. But why are you doingexec bash
in the first place?
â Mikel
Jul 11 at 16:10
@Mikel Updated in original, this was the simplest form of the problem, the reason I need to find out how to run things as the original shell is because I must run a script and #!/bin/bash has different permissions than what was used to create the definition for the script.
â Xander May
Jul 11 at 17:21
Can you show us the output oftype tcpdump
before and after?
â Mark Plotnick
Jul 11 at 17:37
1
Tryexec -a -bash bash
; I think that ought to set things up so that your shell init files are read in by the new bash and thus you'll see all your aliases.
â Mark Plotnick
Jul 11 at 17:56
Can you run
groups
before and after. Put the result in the question.â ctrl-alt-delor
Jul 11 at 16:09
Can you run
groups
before and after. Put the result in the question.â ctrl-alt-delor
Jul 11 at 16:09
1
1
The
-
just means it's a login shell. Try exec bash -l
. I wonder if this is somehow related to SELinux or some other role-based access control system. But why are you doing exec bash
in the first place?â Mikel
Jul 11 at 16:10
The
-
just means it's a login shell. Try exec bash -l
. I wonder if this is somehow related to SELinux or some other role-based access control system. But why are you doing exec bash
in the first place?â Mikel
Jul 11 at 16:10
@Mikel Updated in original, this was the simplest form of the problem, the reason I need to find out how to run things as the original shell is because I must run a script and #!/bin/bash has different permissions than what was used to create the definition for the script.
â Xander May
Jul 11 at 17:21
@Mikel Updated in original, this was the simplest form of the problem, the reason I need to find out how to run things as the original shell is because I must run a script and #!/bin/bash has different permissions than what was used to create the definition for the script.
â Xander May
Jul 11 at 17:21
Can you show us the output of
type tcpdump
before and after?â Mark Plotnick
Jul 11 at 17:37
Can you show us the output of
type tcpdump
before and after?â Mark Plotnick
Jul 11 at 17:37
1
1
Try
exec -a -bash bash
; I think that ought to set things up so that your shell init files are read in by the new bash and thus you'll see all your aliases.â Mark Plotnick
Jul 11 at 17:56
Try
exec -a -bash bash
; I think that ought to set things up so that your shell init files are read in by the new bash and thus you'll see all your aliases.â Mark Plotnick
Jul 11 at 17:56
 |Â
show 6 more comments
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
Problem : After executing exec bash
the aliases present in the default login prompt are lost causing some commands to not work as expected, such as tcpdump in the following example
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
The Fix : You can do what I did and figure out how the aliases change between the different prompts
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
and then change the script to use those sudo tcpdump
instead of plain tcpdump
.
Or alternatively you can restore all the aliases present in the original prompt by running exec -a -bash bash
(which is apaprently not recommended, see @ctrl-alt-delor's comment)
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
accepted
Problem : After executing exec bash
the aliases present in the default login prompt are lost causing some commands to not work as expected, such as tcpdump in the following example
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
The Fix : You can do what I did and figure out how the aliases change between the different prompts
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
and then change the script to use those sudo tcpdump
instead of plain tcpdump
.
Or alternatively you can restore all the aliases present in the original prompt by running exec -a -bash bash
(which is apaprently not recommended, see @ctrl-alt-delor's comment)
add a comment |Â
up vote
1
down vote
accepted
Problem : After executing exec bash
the aliases present in the default login prompt are lost causing some commands to not work as expected, such as tcpdump in the following example
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
The Fix : You can do what I did and figure out how the aliases change between the different prompts
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
and then change the script to use those sudo tcpdump
instead of plain tcpdump
.
Or alternatively you can restore all the aliases present in the original prompt by running exec -a -bash bash
(which is apaprently not recommended, see @ctrl-alt-delor's comment)
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
Problem : After executing exec bash
the aliases present in the default login prompt are lost causing some commands to not work as expected, such as tcpdump in the following example
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
The Fix : You can do what I did and figure out how the aliases change between the different prompts
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
and then change the script to use those sudo tcpdump
instead of plain tcpdump
.
Or alternatively you can restore all the aliases present in the original prompt by running exec -a -bash bash
(which is apaprently not recommended, see @ctrl-alt-delor's comment)
Problem : After executing exec bash
the aliases present in the default login prompt are lost causing some commands to not work as expected, such as tcpdump in the following example
-bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: WARNING: port1: no IPv4 address assigned
tcpdump: listening on port1, link-type EN10MB (Ethernet), capture size 65535 bytes
0 packets captured
0 packets received by filter
0 packets dropped by kernel
-bash-4.2$ exec bash
bash-4.2$ tcpdump -i port1 -w /home/user/$HOSTNAME-port1.pcap -c10000 -G300
tcpdump: port1: You don't have permission to capture on that device
(socket: Operation not permitted)
The Fix : You can do what I did and figure out how the aliases change between the different prompts
-bash-4.2$ type tcpdump
tcpdump is aliased to 'sudo /usr/sbin/tcpdump'
-bash-4.2$ exec bash
bash-4.2$ type tcpdump
tcpdump is /usr/sbin/tcpdump
and then change the script to use those sudo tcpdump
instead of plain tcpdump
.
Or alternatively you can restore all the aliases present in the original prompt by running exec -a -bash bash
(which is apaprently not recommended, see @ctrl-alt-delor's comment)
answered Jul 11 at 19:09
Xander May
164
164
add a comment |Â
add a comment |Â
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
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f454717%2fget-back-to-default-login-shell-after-running-bin-bash%23new-answer', 'question_page');
);
Post as a guest
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
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
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
Can you run
groups
before and after. Put the result in the question.â ctrl-alt-delor
Jul 11 at 16:09
1
The
-
just means it's a login shell. Tryexec bash -l
. I wonder if this is somehow related to SELinux or some other role-based access control system. But why are you doingexec bash
in the first place?â Mikel
Jul 11 at 16:10
@Mikel Updated in original, this was the simplest form of the problem, the reason I need to find out how to run things as the original shell is because I must run a script and #!/bin/bash has different permissions than what was used to create the definition for the script.
â Xander May
Jul 11 at 17:21
Can you show us the output of
type tcpdump
before and after?â Mark Plotnick
Jul 11 at 17:37
1
Try
exec -a -bash bash
; I think that ought to set things up so that your shell init files are read in by the new bash and thus you'll see all your aliases.â Mark Plotnick
Jul 11 at 17:56