Posts

Showing posts from October, 2024

SFTP journey

 To set up an SFTP server for your existing user karl , allowing uploads to /var/www and its subdirectories while still providing SSH access without restricting him to SFTP only, follow these steps: Prerequisites Ensure you have root or sudo access to the server. OpenSSH server should be installed. Steps Open SSH Configuration File : sudo nano /etc/ssh/sshd_config Add/Modify SFTP Configuration : Find the section related to Subsystem sftp . If it exists, it may look like this: Subsystem sftp /usr/lib/openssh/sftp-server If it doesn't exist, you can add it. After that, add a new section for the karl user. Place this below the Subsystem sftp line: Match User karl ChrootDirectory /var/www ForceCommand internal-sftp AllowTcpForwarding no X11Forwarding no Set Permissions : The ChrootDirectory must be owned by root and not writable by anyone else. Adjust permissions as follows: sudo chown root:root /var/www sudo chmod 755 /var/www For any subdirectories where karl s...

ngnix journey

  Step 3: Configure Nginx Server Block Create a directory for the web page (replace with your desired path if needed): sudo mkdir -p /var/www/caputxeta Assign ownership to the current user (replace with your user): sudo chown -R $USER : $USER /var/www/caputxeta Create a simple index.html file for testing: echo "<h1>Welcome to Caputxeta</h1>" > /var/www/caputxeta/index.html Create a new server block configuration file: sudo nano /etc/nginx/sites-available/caputxeta Add the following configuration to the file: server { listen 80; server_name caputxeta.kbytes.net caputxeta.internal.kbytes.net; root /var/www/caputxeta; index index.html; location / { try_files $uri $uri/ =404; } } Enable the site by creating a symbolic link to sites-enabled : sudo ln -s /etc/nginx/sites-available/caputxeta /etc/nginx/sites-enabled/ Test the Nginx configuration for syntax errors: sudo nginx -t Reload Nginx to apply the changes: sudo systemctl r...

git journey

28JAN2025 Moving local folders was a breeze!  Close VS code.  Move the folder.  Reopen. Done. git remote -v To check remote folder is correct git remote set-url origin <new-repository-URL> ..if not 23OCT2024 Make sure your .gitignore and .gitattributes files are in place. In VS you can press: CTRL + ' Or in Ubuntu go to the root of the solution in terminal git init git add . git commit -m "Initial commit" Then Create a Repository on GitHub : Go to GitHub and log in. Click on the New button to create a new repository. Name the repository, set it to public or private, and create it. Add the Remote Repository : Copy the repository URL from GitHub and use it to add a remote in your local Git. git remote add origin https://github.com/your-username/your-repository.git Push Your Code : Push your local repository to GitHub. git push -u origin master  (check if master or main) git branch   listed the branch, funnily enough Then later after some code-peddling git...

RAID 1 on boot device in Software on Ubuntu

 This was learnt  https://askubuntu.com/questions/1482340/rescue-usb-for-ubuntu-server-22-04 But what was also learnt was it really struggles.  Currenly installer is goosed, and you have to blind-fly the disk selection - but that might not be the end of it... Trying to convert an already running device with the boot on it... another level. Best to get a hardware RAID device I think....

Prevent Click-jacking

  Edit the web.config file (Optional) You can also add the header directly by modifying the web.config file of your website: Open the web.config file located in your site's root directory. Add the following code within the <system.webServer> section: xml Copy code < system.webServer > < httpProtocol > < customHeaders > < add name = "X-Frame-Options" value = "DENY" /> </ customHeaders > </ httpProtocol > </ system.webServer > If you want to allow framing only within the same origin, use SAMEORIGIN instead of DENY : xml Copy code < add name = "X-Frame-Options" value = "SAMEORIGIN" /> Save the web.config file and restart IIS (if necessary) to apply the changes.