Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4060

Beginners • Re: How to allow root level access thru SFTP/SMB

$
0
0
I'm using NGINX to host a web server on my Pi 5 and would like to be able to edit my webpages/website directly via SFTP/SMB. I have Samba setup and created a root folder (/) that I am able to access on my Windows PC. However, I am unable to write to that folder (/var/www/html) and is view only since I assume it is outside of the user folder. I want to be able to have full root access that way I am able to write to that folder and I've tried doing just that with no success. Here's the code I put in my smb.conf file in Samba:

Code:

[root]path = /writeable = yesbrowseable = yespublic = nocreate mask = 0777directory mask = 0777
Is there another way to do this or maybe a safer way? I know this is potentially a huge security risk but am not sure of other options on how to edit root-level files via SFTP/SMB.

TLDR; I want to be able to edit root-level files directly on my Pi from my Windows PC but am having trouble as they are write only.
I cannot strongly enough recommend that you do not expose any service to any network running as Root, or with equivalent permissions.

From a workflow point of view, this isn't really what you want. I'd recommend as a light-touch workflow to instead:

1. Create a private GitHub/git repository to host your website. This has numerous advantages, including versioning your site.
2. Create a SSH key on your Raspberry Pi, and put that into your GitHub/git account so you can pull your website updates when you choose
3. Use an editor of your choice to edit the website _inside the repo_ on your Windows machine. Make as many changes as you like, but remember to push them to your repo
4. When you want to 'deploy' the website and see the changes published, use Raspberry Pi Connect Remote shell to 'git pull' a copy of your repository
5. Using Remote shell, copy the website into your web server's document area - probably using sudo.

Statistics: Posted by tdewey — Fri Jun 28, 2024 1:48 pm



Viewing all articles
Browse latest Browse all 4060

Trending Articles