• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

server

Windows Curl Command

January 11, 2023

If you have to download a file from the Internet on a Windows server, can certainly use the browser. But if the browser is rendering the file instead of downloading them, you may have to use the curl command which is already pre-installed on most Windows servers. Just open the command line. Here’s the the curl command to download a file.

curl.exe --output index.txt --url https://website.domain/index.txt

curl.exe --output index.txt --url https://website.domain/index.txt

Filed Under: Misc Tagged With: curl, download, server, windows

Python Web Server

May 20, 2022

Here’s a quick way to start a web server using Python (not recommended for production).

If you want to use python3, you may have to use explicitly use python3.

Check what versions you have first.

python --version
python3 --version

python --version python3 --version

Start web server using port 8080 in the current directory.

python -m http.server 8080

python -m http.server 8080

If you want an alternate directory, use this -d option.

python -m http.server 8080 -d /tmp

python -m http.server 8080 -d /tmp

It’s a great tool for quick downloads.

Filed Under: Linux Tagged With: download, python, server, web

Tomcat Install

June 4, 2021

Tomcat requires JRE.

wget jre-8uversion-linux-x64.tar.gz
# or
apt-get install default-jdk

wget jre-8uversion-linux-x64.tar.gz # or apt-get install default-jdk

Install Tomcat 8 on Linux.

wget https://mirrors.gigenet.com/apache/tomcat/tomcat-8/v8.5.66/bin/apache-tomcat-8.5.66.tar.gz
tar zxpvf apache-tomcat-8.5.66.tar.gz
cd /opt/tomcat/apache-tomcat-8.5.66/bin/
./startup.sh

wget https://mirrors.gigenet.com/apache/tomcat/tomcat-8/v8.5.66/bin/apache-tomcat-8.5.66.tar.gz tar zxpvf apache-tomcat-8.5.66.tar.gz cd /opt/tomcat/apache-tomcat-8.5.66/bin/ ./startup.sh

Status|Start|Stop|Restart Tomcat.

systemctl status tomcat8
systemctl start tomcat8
systemctl stop tomcat8
systemctl restart tomcat8

systemctl status tomcat8 systemctl start tomcat8 systemctl stop tomcat8 systemctl restart tomcat8

Filed Under: Misc Tagged With: apache, install, restart, server, start, status, stop, tomcat, web

Encrypt Samba Share

November 16, 2020

Here’s how to turn on Samba encryption on a share.

Edit /etc/samba/smb.conf on the Samba server.

[global]
server max protocol = SMB3
smb encrypt = required 
lanman auth = no

[global] server max protocol = SMB3 smb encrypt = required lanman auth = no

Edit /etc/samba/smb.conf on the Samba clients.

[global]
smb encrypt = required
client min protocol = SMB2
client max protocol = SMB3

[global] smb encrypt = required client min protocol = SMB2 client max protocol = SMB3

To connect.

smbclient -e -m SMB3 //xxx.xxx.xxx.xxx/share-name -U username

smbclient -e -m SMB3 //xxx.xxx.xxx.xxx/share-name -U username

Filed Under: Linux Tagged With: client, encryption, samba, server, smb.conf

Copy SSH Key to Server

June 16, 2020

Here’s the command to copy a secret key to a remote server.

ssh-copy-id user@servername

ssh-copy-id user@servername

This assumes you already generated a key.

Filed Under: Linux Tagged With: copy, key, secret, server, ssh, ssh-copy-id

Windows Route Add

January 14, 2020

Here’s how to add a route in Windows. Open CMD as Administrator.

route add 10.10.10.10 mask 255.255.255.0 10.10.10.254

route add 10.10.10.10 mask 255.255.255.0 10.10.10.254

To make it persistent, add -p.

route add 10.10.10.10 mask 255.255.255.0 10.10.10.254

route add 10.10.10.10 mask 255.255.255.0 10.10.10.254

To display. Specifies IP 4 only.

route print -4

route print -4

Filed Under: Windows Tagged With: add, display, permanent, persistence, print, route, server, windows

GCP Web Server

January 8, 2020

Here’s a quick script to stand up a web server based on Centos image.

gcloud compute instances create [VM-NAME] \
    --zone=[ZONE] \
    --image-family=debian-9 \
    --image-project=debian-cloud \
    --tags=allow-ssh,allow-health-check \
    --subnet=lb-subnet \
    --metadata=startup-script='#! /bin/bash
apt-get update
apt-get install apache2 -y
a2ensite default-ssl
a2enmod ssl
vm_hostname="$(curl -H "Metadata-Flavor:Google" \
http://169.254.169.254/computeMetadata/v1/instance/name)"
echo "Page served from: $vm_hostname" | \
tee /var/www/html/index.html
systemctl restart apache2'

gcloud compute instances create [VM-NAME] \ --zone=[ZONE] \ --image-family=debian-9 \ --image-project=debian-cloud \ --tags=allow-ssh,allow-health-check \ --subnet=lb-subnet \ --metadata=startup-script='#! /bin/bash apt-get update apt-get install apache2 -y a2ensite default-ssl a2enmod ssl vm_hostname="$(curl -H "Metadata-Flavor:Google" \ http://169.254.169.254/computeMetadata/v1/instance/name)" echo "Page served from: $vm_hostname" | \ tee /var/www/html/index.html systemctl restart apache2'

Filed Under: Cloud Tagged With: apache, debian, gcp, metadata, server, vm, web

Windows Boot Time

December 2, 2019

Here’s how to find when a Windows server was last rebooted.

systeminfo | find /i "boot time"

systeminfo | find /i "boot time"

Filed Under: Windows Tagged With: boot, cmd, last, server, windows

  • Go to page 1
  • Go to page 2
  • Go to Next Page »
  • Home
  • About
  • Archives

Copyright © 2023