Today I noticed an alert that WordPress version 7.0.3 was available. I decided to update, but got the annoying prompt to enter FTP credentials. Usually, just running chown -R wwwrun /srv/www/htdocs would usually fix the issue, but not today. After digging around, I found I needed to add three lines to my wpconfig.php config file above the /* That’s all, stop editing! Happy publishing. */ line which resolved the issue.
The final line was the real kicker that made the function work again. FS_METHOD allows WordPress to write files directly to the filesystem without using FTP or SSH. Never needed it before, guess this is something new. Fun in the world of self-hosting.
All is good now, and I can now update my boring WordPress site again.
I came across an issue with trying to use the ping command after I installed the latest SparkyLinux (A Debian based distro). It would only work when run as sudo, but I got an error, “missing cap_net_raw+p” when run as a normal user. After some digging, I found the solution on a blog post at ShallowSky.com. https://shallowsky.com/blog/linux/ping-permissions.html
Ping command not working. missing cap_net_raw+p.
The fix? Installlinux-sysctl-defaults then reboot your machine.
I use Action1 to manage endpoints across many locations. The one thing Action1 is not excellent at and does not plan to be is a great remote access tool. Self-hosting RustDesk fits in perfectly for this need. I created a powershell script that can be run via Action1 to quickly install the RustDesk client onto all my endpoints silently along with adding a custom value to Action1 to let me know the RustDesk ID of each endpoint. This post is not about how to create your own self-hosted version of RustDesk, merely, show an example of how to deploy it via Action1 (Or similar tool) easily via a powershell automation.
The script below is sequential is very easy to follow. Modify it as you need.
Action1 Portal showing RustDesk ID fed via install script.
<#
.NOTES
Author: C. Weis
Versions:
251203 Initial
.SYNOPSIS
Install RustDesk client.
.DESCRIPTION
Install RustDesk client with custom self hosted settings.
Example created to show deployment via Action1.
.EXAMPLE
[PS] C:\>.\RustDesk-Installer.ps1
#>
<# --------------------------------------------------------------------------------
RustDesk configuration file.
This is the contents of a file that will be created to replace configuration
file that RustDesk installer creates. This file will contain info for self
hosted server and key file.
----------------------------------------------------------------------------------- #>
$rd_config = @"
rendezvous_server = 'rs-ny.rustdesk.com:21116'
nat_type = 1
serial = 0
unlock_pin = ''
trusted_devices = ''
[options]
custom-rendezvous-server = 'PATH OR IP OF YOUR SELF HOSTED SERVER HERE'
direct-server = 'Y'
av1-test = 'N'
allow-remote-config-modification = 'Y'
key = 'YOUR CUSTOM KEY FILE CODE HERE'
relay-server = 'PATH OR IP OF YOUR SELF HOSTED SERVER HERE'
"@
<# --------------------------------------------------------------------------------
Download Rustdesk MSI and drop into Temp directory.
----------------------------------------------------------------------------------- #>
$rd_src = 'https://github.com/rustdesk/rustdesk/releases/download/1.4.4/rustdesk-1.4.4-x86_64.msi'
$rd_dst = "$env:TEMP\rustdesk-1.4.4-x86_64.msi"
Invoke-RestMethod -Uri $rd_src -OutFile $rd_dst
<# --------------------------------------------------------------------------------
Start Installation.
----------------------------------------------------------------------------------- #>
Write-Host "Calling Installer: $rd_dst"
Start-Process 'msiexec' -ArgumentList "/i ""$rd_dst"" /qn INSTALLFOLDER=""C:\Program Files\RustDesk"" CREATESTARTMENUSHORTCUTS=""Y"" CREATEDESKTOPSHORTCUTS=""N"" INSTALLPRINTER=""N"" /l*v RDinstall.log" -Wait
# This delay is needed for lower end devices to finish installation process successfully.
Write-Host "Install completed. Pausing 30 Seconds."
Start-Sleep -Seconds 30
<# --------------------------------------------------------------------------------
Stop service and drop in new config file.
This assumes script being run as localsys.
----------------------------------------------------------------------------------- #>
Stop-Service -Name RustDesk
$rd_configpath = 'C:\WINDOWS\ServiceProfiles\LocalService\AppData\Roaming\RustDesk\config'
$rd_config | Out-File -FilePath "$rd_configpath\RustDesk2.toml" -Encoding UTF8 -Force
Start-Service -Name RustDesk
<# --------------------------------------------------------------------------------
Set Password
Password is created based partially on machine name.
Grab second through the fith characters of computername to create first
part of password. Then add additional string: ##Soda.
----------------------------------------------------------------------------------- #>
$rd_app = "C:\Program Files\RustDesk\RustDesk.exe"
$rd_pass = $Env:computername
$rd_pass = $rd_pass.Substring(1, 4) + "##Soda"
Start-Process $rd_app -ArgumentList "--password $rd_pass"
Write-Host "Password Set: $rd_pass"
<# --------------------------------------------------------------------------------
Retrieve key ID number.
Send to Text file in program directory and push to Action1 custom attribute.
----------------------------------------------------------------------------------- #>
$rd_id = & $rd_app --get-id | Out-String
$rd_id = $rd_id.Trim()
$rd_id | Out-File -FilePath "C:\Program Files\RustDesk\RustDesk-ID.txt" -Encoding UTF8 -Force
# Have Action1 set the RustDesk ID to a custom attribute named, "RustDesk ID".
Action1-Set-CustomAttribute 'RustDesk ID' $rd_id