Filezilla Sftp Sudo Su

Posted onby admin
Filezilla Sftp Sudo SuFilezilla Sftp Sudo Su
SFTP and FULL root privileges-changing chmod on folders, deleting,editing
Posted on: Aug 5, 2012 9:51 AM
Hi Guys,
I have LAMP installed on an EC2 instance and I use sftp with filezilla to access the root files/folders. I am running a php/mysql website successfully within. I know using Putty I can login via ssh using my user name and switch to root access using 'sudo su' command but how do I get all root privileges when using sftp? As it stands I have to all the chmod'ing via ssh as I cant do it via sftp with filezilla which is a pain. If I edit a file using filezilla I cant be assured that the file was in fact edited as Filezilla says successful but the permissions prevented the change when i check the file later.
Its just a pain. I have other cloud hosting with onapp where I dont have this issue?
Any idea how to sftp with full root privileges?
Thanks
Edited by: Howard Canning on Aug 5, 2012 9:51 AM
Edited by: Howard Canning on Aug 5, 2012 9:52 AM
Replies: 6 Pages: 1 - Last Post: Jan 13, 2014 3:22 PM by: Benjamin Bernard
Re: SFTP and FULL root privileges-changing chmod on folders, deleting,editing
Posted on: Aug 6, 2012 4:34 PM
...anyone
My user name is ubuntu for ssh purposes and I sudo su to allow me root privileges. On Googling reference is made to the user 'ec2-user' but I cant connect via filezilla and the key pair with that. I can only connect with the 'ubuntu' username and the key pair. Hmmm. Why dont I have full root access straight off and why do I have to sudo su to get root privileges? Quite new to all this.
Thanks
Edited by: Howard Canning on Aug 6, 2012 4:35 PM
Re: SFTP and FULL root privileges-changing chmod on folders, deleting,editing
Posted on: Aug 11, 2012 11:56 AM
Hello,
There is no way to get elevated privileges using sftp. You only have access to the commands that your user has access to.
You can, however, make it so you can login as root - though this is not a recommended configuration it will give you the access that you need.
Directions:
  • SSH into your instance
  • sudo su -
  • vi /etc/ssh/sshd_config
  • find PermitRootLogin (/ then type PermitRootLogin hit enter)
  • Replace PermitRootLogin forced-commands-only with PermitRootLogin without-password (i to insert)
  • :wq - to save and quit
  • vi ~/.ssh/authorized_keys
  • remove: command='echo 'Please login as the ec2-user user rather than root user.';echo;sleep 10' (it should now start with ssh-rsa)
  • :wq - to save and quit
  • /etc/init.d/sshd reload (Reload the SSH daemon)

Regards,
David S.
Re: SFTP and FULL root privileges-changing chmod on folders, deleting,editing
Posted on: Aug 11, 2012 2:58 PM
Thanks, i figured out that if I install vsftpd and create a user & password, I can sftp my website files to eg home/username/public_html and then use filezilla or dreamweaver to move,edit,chmod,unzip files etc..I was sshing using root and trying to alter files using my sftp/vsftpd user which was causing the permissions issue.
All good now.
Thanks
Re: SFTP and FULL root privileges-changing chmod on folders, deleting,editing
Posted on: Jun 2, 2013 11:09 AM
vi ~/.ssh/authorized_keys
remove: command='echo 'Please login as the ec2-user user rather than root user.';echo;sleep 10' (it should now start with ssh-rsa)

i cant edit this file, so i'm inside the file but i cant delete the text :((
step1 sudo su
step 2 vi ~/.ssh/authorized_keys (ok, im in)
step 3 remove: command='echo 'Please login as the ec2-user user rather than root user.';echo;sleep 10' (it should now start with ssh-rsa) - cool, but i cant. i cant edit anything inside
Re: SFTP and FULL root privileges-changing chmod on folders, deleting,editing
Posted on: Jun 2, 2013 11:17 AM
it is strange a bit, i can delete text inside only if i'm write text no other way so i'm done here. but last part still looks bad
bash: /etc/init.d/sshd: No such file or directory
[email protected]:/home/ubuntu#
as a result: /etc/phpmyadmin/config.inc.php: open for write: permission denied
p.s
[email protected]:/home/ubuntu# /etc/init.d/ssh reload
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service ssh reload
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the reload(8) utility, e.g. reload ssh
=------------
what does it mean? permission still denied
Edited by: awsnewbie2013 on Jun 2, 2013 11:38 AM
Re: SFTP and FULL root privileges-changing chmod on folders, deleting,editing
Posted on: Jan 12, 2014 8:59 PM
I too, am having problems with privileges... It might be that I am new to all this
I created my instance... was able to SSH in... Followed the instructions for a LAMP server...
But when I try to SFTP (using transmit on mac) I can access the server and see all the folders that were created with the installation... But I can not add any files to the server... It says make sure you have the permissions to do that and then just dose not complete the command... Certain files I can not even see...
I am assuming this kind of security is a good thing for most of the folders in my ec2 instance...
But I want to add content to the var/www/http folder so I think I need to change the chmod value for that folder to allow writing... But I am not sure how to do this... Any help would be massively appreciated...
p.s.
Perhaps I am going about this in the wrong way... But when I was reading over everything I thought this would work but I finding it might not... I thought that I would launch my instance then add EBS for the root system... then I would add another EBS (like 2GB) attachment for each website that I wanted to run... haha I thought this would look way different when I finally got the see the files with a GUI... I dont know why I thought that each EBS would be like a folder in my ec2 server that I could copy wordpress to and then install and finally associate at Elastic IP to to that EBS volume... Then I would use rout53 to change the IP's to domains that I own through gandi.net
On paper this seemed logical and awesome... But I think I was way off... haha... any advice would be really helpful...
Thank you so much!
Edited by: Benjamin Bernard on Jan 13, 2014 3:21 PM
Nevermind... I think I posted this in the wrong place... Ill create a new thread...
Reply to this Thread
Answered question
Unanswered question with answer points still available
Unanswered question
Ace: 2000+ pts
Expert: 750-1999 pts
Guide: 300-749 pts
Enthusiast: 50-299 pts
Newbie: 5-49 pts
Amazonian

Configure filezilla sftpSudoFilezilla sftp command line

Filezilla Sftp Setup

Run sudo systemctl restart vsftpd to restart the service and test your connection using Filezilla. Debugging FTP Connections. If you're having issues with your FTP connection, check on the service with the following commands sudo systemctl -l status vsftpd sudo tail -f /var/log/vsftpd.log. To test FTP connections via commandline, run the following. My user name is ubuntu for ssh purposes and I sudo su to allow me root privileges. On Googling reference is made to the user 'ec2-user' but I cant connect via filezilla and the key pair with that. I can only connect with the 'ubuntu' username and the key pair.