Remote development/editing using Visual Studio Code

techlists at phpcoderusa.com techlists at phpcoderusa.com
Mon Nov 4 11:34:32 MST 2024


I appreciate everyone's feed back.  When I started this journey I failed 
to understand that the docroot needed to be owned by a user that is SSH 
enabled.

I am using Ubuntu 24.04lts with a standard LAMP config.

A friend who owns a hosting company pointed out that the docroot cannot 
be owed by www-date:www-data AND have the ability to be edited remotely 
using Visual Studio Code.  He said I needed to configure my server to 
use PHP-FPM so the Docroot can be owned by a SSH enabled user.

So I followed the following steps:


1) Add User and configured AllowUsers in /etc/ssh/sshd_config

2) Change that user's home directory to the docroot  :  sudo usermod -d 
/var/www/domain.tld/public_html (this is for convenience only) user is 
not jailed into the Docroot.

3) Configured PHP-FPM for multiple virtual hosts, this allows the SSH 
user to be the owner of Docroot so I can add/edit/delete files and 
directories using Visual Studio Code editing remotely.

4) Set owner for Docroot  :  sudo chown -R user:user /var/www/domain.tld

5) Visual Studio Code - edit remote using the Remote-SSH plugin.

I can add/edit/delete using VSC

I can view the index.php contents in my browser using a non-routable 
domain domain-name.internal which is configured using the hosts files.

Given some simple testing everything seems to be working.

Thank you all for your responses.  They help so much!!

Keith







On 2024-11-03 20:32, David Schwartz via PLUG-discuss wrote:
> You could set up a crontab that runs rsync/ssh/etc
> 
> Also, I seem to recall there’s a way to monitor a folder for changes
> that could trigger rsync/etc
> 
> Doesn’t it have something that lets you connect to a git repo?
> 
>  -David Schwartz
> 
>> On Nov 3, 2024, at 8:05 PM, Michael via PLUG-discuss
>> <plug-discuss at lists.phxlinux.org> wrote:
>> 
>> One option is to create a VSCode task that FTPs a copy to the
>> remote machine each time a file is saved (use the Trigger Task on
>> Save extension).
>> 
>> On 11/3/24 2:00 PM, plug-discuss-request at lists.phxlinux.org wrote:
>> 
>>> Message: 1
>>> Date: Sat, 02 Nov 2024 15:15:46 -0700
>>> From: techlists at phpcoderusa.com
>>> To: Main PLUG discussion list <plug-discuss at lists.phxlinux.org>
>>> Subject: Remote development/editing using Visual Studio Code
>>> Message-ID: <1a6d6a372161d0170ac5794f9f712504 at phpcoderusa.com>
>>> Content-Type: text/plain; charset=US-ASCII; format=flowed
>>> 
>>> Hi,
>>> 
>>> I am looking for a plugin for Visual Studio Code that allows me to
>>> 
>>> connect via SFTP and stores the code local and remote.
>>> 
>>> Does anyone have a suggestion.
>>> 
>>> Thanks!!
>>> Keith
>> ---------------------------------------------------
>> PLUG-discuss mailing list: PLUG-discuss at lists.phxlinux.org
>> To subscribe, unsubscribe, or to change your mail settings:
>> https://lists.phxlinux.org/mailman/listinfo/plug-discuss
> ---------------------------------------------------
> PLUG-discuss mailing list: PLUG-discuss at lists.phxlinux.org
> To subscribe, unsubscribe, or to change your mail settings:
> https://lists.phxlinux.org/mailman/listinfo/plug-discuss


More information about the PLUG-discuss mailing list