Sunday, November 15, 2015

ssh - Change permission of files with the owner 'apache'



Hay, i have some files on my server with the owner set to "apache", I'm not quite sure how this happened.



Anyway, i need to change the permission of these files to 0777 so i can download/edit them. However i cannot.




I'm using a 1and1 Linux server and use Plesk to administrate it.



I have the ability to login via SSH. However, if i run chmod or chown i get a "permission denied" error, and if i try to sudo chmod or chown it says the command cannot be found.



When i go to edit my domain details, i get this option



Shell access to server with FTP user's credentials



and have these options



/bin/sh
/bin/bash
/sbin/nologin
/bin/bash (chrooted)
/bin/rbash


Any idea's how i should go about changing the permissions or changing the owner?




Thanks


Answer



Use php's chmod function.



chmod("/somedir/somefile", 0777);
?>



also you can also use shell_exec function



echo shell_exec("chmod 777 /somedir/somefile");
?>

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...