sed to change userid in /etc/passwd to zero
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am trying to change user monitor uid in /etc/passwd , but below gives me an error:
sed -s /etc/passwd <<-"EOF"
/^(monitor:[^:]*:)[0-9]*:[0-9]*:/s//10:0:/
w
q
EOF
sed passwd uid
 |Â
show 3 more comments
up vote
0
down vote
favorite
I am trying to change user monitor uid in /etc/passwd , but below gives me an error:
sed -s /etc/passwd <<-"EOF"
/^(monitor:[^:]*:)[0-9]*:[0-9]*:/s//10:0:/
w
q
EOF
sed passwd uid
7
... This sounds like a tremendously bad idea if you accidentally succeed. What are you actually trying to accomplish?
â Shadur
Oct 10 '17 at 14:11
3
Use usermod -u. That's what it is there for
â Raman Sailopal
Oct 10 '17 at 14:13
6
You're confusingsed
withed
â Stéphane Chazelas
Oct 10 '17 at 14:15
4
Why do you "need" to change userid to 0? I bet if you explained the problem you are really trying to solve, somebody would come up with a better idea of how to solve it.
â NickD
Oct 10 '17 at 14:19
2
How have you added the user to the admin group? With groupmod?
â Raman Sailopal
Oct 10 '17 at 14:43
 |Â
show 3 more comments
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to change user monitor uid in /etc/passwd , but below gives me an error:
sed -s /etc/passwd <<-"EOF"
/^(monitor:[^:]*:)[0-9]*:[0-9]*:/s//10:0:/
w
q
EOF
sed passwd uid
I am trying to change user monitor uid in /etc/passwd , but below gives me an error:
sed -s /etc/passwd <<-"EOF"
/^(monitor:[^:]*:)[0-9]*:[0-9]*:/s//10:0:/
w
q
EOF
sed passwd uid
sed passwd uid
asked Oct 10 '17 at 14:07
irom
186110
186110
7
... This sounds like a tremendously bad idea if you accidentally succeed. What are you actually trying to accomplish?
â Shadur
Oct 10 '17 at 14:11
3
Use usermod -u. That's what it is there for
â Raman Sailopal
Oct 10 '17 at 14:13
6
You're confusingsed
withed
â Stéphane Chazelas
Oct 10 '17 at 14:15
4
Why do you "need" to change userid to 0? I bet if you explained the problem you are really trying to solve, somebody would come up with a better idea of how to solve it.
â NickD
Oct 10 '17 at 14:19
2
How have you added the user to the admin group? With groupmod?
â Raman Sailopal
Oct 10 '17 at 14:43
 |Â
show 3 more comments
7
... This sounds like a tremendously bad idea if you accidentally succeed. What are you actually trying to accomplish?
â Shadur
Oct 10 '17 at 14:11
3
Use usermod -u. That's what it is there for
â Raman Sailopal
Oct 10 '17 at 14:13
6
You're confusingsed
withed
â Stéphane Chazelas
Oct 10 '17 at 14:15
4
Why do you "need" to change userid to 0? I bet if you explained the problem you are really trying to solve, somebody would come up with a better idea of how to solve it.
â NickD
Oct 10 '17 at 14:19
2
How have you added the user to the admin group? With groupmod?
â Raman Sailopal
Oct 10 '17 at 14:43
7
7
... This sounds like a tremendously bad idea if you accidentally succeed. What are you actually trying to accomplish?
â Shadur
Oct 10 '17 at 14:11
... This sounds like a tremendously bad idea if you accidentally succeed. What are you actually trying to accomplish?
â Shadur
Oct 10 '17 at 14:11
3
3
Use usermod -u. That's what it is there for
â Raman Sailopal
Oct 10 '17 at 14:13
Use usermod -u. That's what it is there for
â Raman Sailopal
Oct 10 '17 at 14:13
6
6
You're confusing
sed
with ed
â Stéphane Chazelas
Oct 10 '17 at 14:15
You're confusing
sed
with ed
â Stéphane Chazelas
Oct 10 '17 at 14:15
4
4
Why do you "need" to change userid to 0? I bet if you explained the problem you are really trying to solve, somebody would come up with a better idea of how to solve it.
â NickD
Oct 10 '17 at 14:19
Why do you "need" to change userid to 0? I bet if you explained the problem you are really trying to solve, somebody would come up with a better idea of how to solve it.
â NickD
Oct 10 '17 at 14:19
2
2
How have you added the user to the admin group? With groupmod?
â Raman Sailopal
Oct 10 '17 at 14:43
How have you added the user to the admin group? With groupmod?
â Raman Sailopal
Oct 10 '17 at 14:43
 |Â
show 3 more comments
1 Answer
1
active
oldest
votes
up vote
1
down vote
accepted
If for some reason usermod -u
can not be used:
sed -i -e 's/^(monitor:[^:]):[0-9]*:[0-9]*:/1:0:0:/' /etc/passwd
Please note it is /1:0
not /10:
as this would be parameter 10.
But having monitor
to have uid 0 might not be a good idea at all.
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
If for some reason usermod -u
can not be used:
sed -i -e 's/^(monitor:[^:]):[0-9]*:[0-9]*:/1:0:0:/' /etc/passwd
Please note it is /1:0
not /10:
as this would be parameter 10.
But having monitor
to have uid 0 might not be a good idea at all.
add a comment |Â
up vote
1
down vote
accepted
If for some reason usermod -u
can not be used:
sed -i -e 's/^(monitor:[^:]):[0-9]*:[0-9]*:/1:0:0:/' /etc/passwd
Please note it is /1:0
not /10:
as this would be parameter 10.
But having monitor
to have uid 0 might not be a good idea at all.
add a comment |Â
up vote
1
down vote
accepted
up vote
1
down vote
accepted
If for some reason usermod -u
can not be used:
sed -i -e 's/^(monitor:[^:]):[0-9]*:[0-9]*:/1:0:0:/' /etc/passwd
Please note it is /1:0
not /10:
as this would be parameter 10.
But having monitor
to have uid 0 might not be a good idea at all.
If for some reason usermod -u
can not be used:
sed -i -e 's/^(monitor:[^:]):[0-9]*:[0-9]*:/1:0:0:/' /etc/passwd
Please note it is /1:0
not /10:
as this would be parameter 10.
But having monitor
to have uid 0 might not be a good idea at all.
answered Oct 10 '17 at 15:53
hschou
1,66349
1,66349
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%2f397236%2fsed-to-change-userid-in-etc-passwd-to-zero%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
7
... This sounds like a tremendously bad idea if you accidentally succeed. What are you actually trying to accomplish?
â Shadur
Oct 10 '17 at 14:11
3
Use usermod -u. That's what it is there for
â Raman Sailopal
Oct 10 '17 at 14:13
6
You're confusing
sed
withed
â Stéphane Chazelas
Oct 10 '17 at 14:15
4
Why do you "need" to change userid to 0? I bet if you explained the problem you are really trying to solve, somebody would come up with a better idea of how to solve it.
â NickD
Oct 10 '17 at 14:19
2
How have you added the user to the admin group? With groupmod?
â Raman Sailopal
Oct 10 '17 at 14:43