Reset Linux filesystem permissions [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I just did something really dumb and I'm wondering if there's any way to reverse it. So I have an AWS EC2 server instance and I was trying to edit the php.ini in /etc. It kept telling me that I didn't have permissions to write to it, so I just thought, "Okay, well nobody's ever really going to see this site, I'll just chmod everything." So I did chmod -R 750 ... I know... I know... What was I thinking. So now it messed everything up and I can't SSH in with my ec2-user login anymore... Is there any way to fix this or did I just permanently wreck it?

If you are using an EBS backed instance, you can recover the SSH access doing this:
Stop your crashed instance
Detach the EBS root device
Create a new instance
Attach the EBS to the new instance and mount it in /mnt
Fix your file permissions in /mnt/home/user/.ssh
Unmount and detach the EBS
Attach it to the crashed instance and start it
You should have ssh access, but note this won't fix all crashed files or directories. It only will give you ssh access, then you have to fix your files permissions. Otherwise, you do this in step 5.
Luck!

Related

Unable to make a directory/mount point writable using chmod [closed]

Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 days ago.
Improve this question
I've mounted an SSD to /mnt/SATA-SSD which has a single exfat partition.
I'd like to make the permissions for the mount point "drwxrwxrwx" but no matter what I try, the permissions wont change from "drwxr-xr-x".
I tried going into the terminal and doing "sudo chmod 777 /mnt/SATA-SSD" which resulted in the permissions remaining at "drwxr-xr-x". I've also tried the same command as root.
I also tried in Dolphin to change the permissions and the write permissions were greyed out.
I'm using Kubuntu 22.10.
It's a drive full of data so I don't really want to reformat it.
I've mounted a few other drives (1. NTFS HDD 2. NTFS SSD 3. NTFS External SSD) in the same way and they don't seem to have this issue. I cant imagine the file format is the issue but at this point I have no idea.
I'm kind of at a loss for how this isn't working. Is there a way to force the permissions to change that's more forceful than chmod or could there some other reason why chmod isn't changing the permissions?

How can I edit a file with copies in 2 different users in linux? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I use AWS vps server and apache2 is installed in it. I want to edit a file "index.html" from 2 different accounts (i.e. 1st user "ubuntu" and second user "www-data"). By now, I try to edit the file but I got permission error so first I change (chown) permission to "ubuntu " and edit file and again change (chown) permission back to "www-data" otherwise I will get permission error in web browser.
I used chmod 777 index.html but this didn't help.
Please help me finding some good solution. Because this is tough to edit. I do have sudo permission if needed.
Thanks in advance!
You have two options:
create a dedicated group and add the ubuntu and www-data users to this group. Then set with chgrp the group of the file and finally give the right permissions to the group with chmod.
If your server suports Access Control Lists (it should), you could use the setfacl command. You can read about the command here and here.

CentOS 6.7 fails to start due to changes in /etc/fstab [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
Apart from the main disk, I used to have another disk attached to the host which is /dev/vdb. In order to mount it automatically, I made changes in the /etc/fstab file.
While after I removed /dev/vdb, my CentOS 6.7 fails to start, and always stops with an error saying /dev/vdb is unavailable.
At this point, I can type the root password to enter into the command prompt, while when I trying to edit /etc/fstab file, it shows it is in read-only mode. I can't understand why it's read-only since I'm already the "root".
I'm sure removing the problematic line from fstab file would resolve my problem, but no idea of how to override the file. Can somebody help me out?
Use a live-cd or -dvd to boot up your system (I find puppy linux works well for this task). Locate your /etc/fstab file on the hard drive and edit it manually.
Exit from the live-cd session, remove the disk and reboot normally. If /etc/fstab has been rewritten correctly you should start normally.
An alternative of course, is to reinstall the /dev/vdb device if possible and edit /etc/fstab if doing that boots correctly.
If it is a Virtual machine than you can mount the fs and make changes in /etc/fstab umount it and boot vm. or you can chroot into vm as well with
sudo chroot /path

SSH refuses connection on CentOS after changing permissions on /etc [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 6 years ago.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Improve this question
I'm really a newbie in the Linux World. I've made change on a CentOS 5.4 server with this command :
sudo chmod -R ugo+rw /etc
Now when I try to connect with Putty from a Windows computer, I get this error :
server unexpectedly closed network connection
I assume the SSH service is running because I've currently another SSH session, that was open before the change, that is already alive. (connected as root)
Thanks in advance for any help.
Best regards,
Guy
It is /var/log/secure where you should see the errors.
The files in /etc/ssh/ can't be writable by the others. And some of them can't be even readable by others (private keys). Fix it such as:
chmod 600 /etc/ssh/ssh_host_*_key
chmod 644 /etc/ssh/ssh_host_*_key.pub /etc/ssh/ssh_config /etc/ssh/moduli
chmod 600 /etc/ssh/sshd_config
You just broke system-wide permissions and you're not allowed to login from security reasons. Try checking logs from /var/log/messages and /var/log/auth.log
grep 'sshd' /var/log/auth.log
You won't fix it easily.

How to install a program in linux for all users not only for root? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
I installed the shrewsoft vpnmanger on my linux (crunchbang kernel 3.2.0-4 amd64) the problem is, that somehow it can only be started as sudo. Can someone explain how i can fix this?
sudo /usr/local/sbin/iked&
How can I change the iked installation so that it is available for each user?
Thanks
It's just about the paths a normal user's shell search for commands. But normally it makes sense that those commands located in a sbin dir are not accessible by typing just the command's name. Those commands need access to protected resources that are only accessible by root.
But if you have the luck that you can gain the full rights by means of sudo you can simply create an alias via
alias iked="sudo /usr/local/sbin/iked"
and add it into your shell's resource file.
To make the full command accessible to all users by simply typing iked you can create a little bash script named iked with content
#!/bin/bash
sudo /usr/local/sbin/iked
and place it in /usr/local/bin.
Of course that implies an appropriate /etc/sudoers file and that the execute permission of iked is set.
try copying or symlinking in it in /usr/bin.
and see if it work for the user then, if it has a global log file (I don't know about this app so not one to comment) but assuming it has some log in /var/log/iked.log and its been written by root you will have permssion issues by another user, so chown it to some neutral group like users or something.:
Try here it may give you more info, I can see you could try:
/usr/bin/iked -d 4
But from what I read it does have a log in /var/log and yep that permission issue would be the primary issue specially if root was the first user to run this app.

Resources