Score:0

I changed my /usr permission of ec2 instance to read only . After that not able to perform any command

in flag

I changed my /usr permission to read only . After that not able to perform any command.

Not event able to execute , "clear" or any other operation , nor able to login as sudo . sudo command is not found.

/usr/ now has following permission : dr--------

What can I do to get following permission back : drwxr-xr-x

I am unable to perform any operation like : vi sudo chmod clear

David avatar
cn flag
Why did you change it? What were you trying to do?
Akshat singh bais avatar
in flag
i was trying to update my node version , for which it wanted to create a folder in bin , so I tried changing its permission and this happened. Any idea , how can I perform othrer activities and set my /usr/ permission back to previous ones ? :( Now I can't even "cd" inside /usr/ .
cn flag
Ray
Create an Ubuntu image on a USB drive. Boot from it. Then mount your `/` drive and try changing the permissions back.
Akshat singh bais avatar
in flag
@Ray . This I did on an ec2 instance . How can i do that what you have suggested ?
in flag
If it’s an EC2 instance, you’re out of luck. Terminate and recreate
cn flag
Ray
Well, `chmod` is just a program that is from the package `coreutils`. I suppose another way is to extract the minimum number of programs you need to fix your problem over to your EC2 instance. You can give that a try. But honestly, it's probably easier to recreate your EC2 instance.
Akshat singh bais avatar
in flag
@matigo are you sure ? No solution is possible ?
Akshat singh bais avatar
in flag
@Ray , I didn't understand : extract the minimum number of programs ? Can you please help me with that
cn flag
Ray
You closed off access to `/usr` so you can try to put `chmod` in your home directory and run that, instead. *If* you had another EC2 instance, for example, you can take its copy of the `chmod` program at `/usr/bin/chmod`, and put it on the system that is giving you problems (i.e., ftp it over). Then, use this `chmod` command to fix `/usr`. If you don't have this option available to you, then you are stuck...
Akshat singh bais avatar
in flag
@Community what part is unclear ? I have mentioned above that accidently I changed /usr/ permission to "Read" only and now I am unable to perform any operation on the server. What can I do to reset the permission or get the earlier permission , so that I can perform normal commands again like : "vi" , "clear" , "sudo" , "chmod"
cn flag
@matigo nope. same method is possible ;-)
Score:0
cn flag

When you are using instances (google cloud, aws, azure) the method to do this is:

Create a new instance, attach the old instance as a mountpoint, fix your settings on the mount point, and boot into your old instance.

Akshat singh bais avatar
in flag
Hey @Rinzwind , thanks for you answer , can you please help me with some steps . Didn't understand.
cn flag
That is going to a very long read and I know how to do it in google gce AWS seems similar and AWS has a guide here: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html But you probably know most of that since you already have an instance(?)
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.