Posts for: #Servers

Create cPanel WHM session from CLI

Sometimes you don’t know or want to change the root password to be able to log into WHM as root (yes I know you shouldn’t log in as root, but sometimes you do). Here’s the command to do that via CLI whmapi1 create_user_session user=root service=whostmgrd locale=en This will return something like to following data: cp_security_token: /cpsess9427258339 expires: '1596644759' locale: en service: whostmgrd session: root:J7omtbeEeUhJ9yPK:create_user_session,yAs86MVYrHT46avjRLAGxhHaEFrFV3Hf url: https://server.domain.com:2087/cpsess9427258339/login/?locale=en&session;=root%2UtnqjEJVUBNo2JnKH%3acreate_user_session%55nNCwxRW4tzqEe6NUYKwWrDM7N485TiYA metadata: command: create_user_session reason: Created session result: 1 version: 1 You will use the URL and it will take you right into WHM
MORE →

SuperMicro ipmitool shared/dedicated NIC change

Here is how to change the NIC for IPMI to be shared or dedicated. I know this works on SuperMicro I’m not sure about other vendors Make sure you have IPMI tool installed and you’re able to connect via ipmitool To Get Lan Mode ipmitool raw 0x30 0x70 0x0C 0x00 It will return a code, here are those and their meanings: 00 dedicated 01 shared 02 Failover Here is how you set the mode
MORE →

Change username for cPanel user

Unfortunately it doesn’t appear cPanel allows you to easily change the username. Most documentation I’ve read says to use the “Rearrange an Account” option, but if you only have one disk that doesn’t seem to get you an option. The downside to this is that is doesn’t fully do a normal restore it will restore the new account to the new directory, but it will symlink the old username to the new directory.
MORE →

Acme.sh with NGiNX

First you have to install acme.sh. I like using acme.sh because it’s all bash based. As with all posts I take no responsibility for anything and this is more of a quick help instead of a full guide. I have a script that I use to deploy my WordPress sites. The only thing I recommend is if you use it make sure to add the xml-rpc.php block. I haven’t added that to it yet.
MORE →

Fix Domain Trust Issues

There error comes in many forms one of the forms are “The trust relationship between this workstation and the primary domain failed.” If you’re able to log into the machine as a local admin it’s easy, you just do the following. Use a local administrator account to log on to the computer. Select Start, press and hold (or right-click) Computer > Properties. Select Change settings next to the computer name. On the Computer Name tab, select Change.
MORE →

Auto Expand last partition using parted

I was having issues finding the correct way to add the remaining free space to the last partition (afraid to do so since it was on a live machine). I was finally able to figure it out. Use this to see free space parted /dev/sdX print free Then this to expand parted /dev/sdX (parted) resizepart Partition number? ENTER NUMBER FROM ABOVE THAT HAS THE LVM End? [1075MB]? 100% (parted) q Then now since this was on a server that uses LVM you have to resize the PV
MORE →

Bypass PiHole DNS using PiHole DHCP

This works if you’re having PiHole hand out DHCP on your network. nano /etc/dnsmasq.d/05-no-pihole-dhcp.conf Now we need to add the following to the file. You can change 1.1.1.1 to anything you want # Assign alternate DNS for select hosts # Set Specific Clients to be affected dhcp-mac=set:altdns,00:00:00:00:00:00 #Device 1 dhcp-mac=set:altdns,00:00:00:00:00:00 #Device 2 # Set Alternate DNS dhcp-option=tag:altdns,option:dns-server,1.1.1.1
MORE →

SmartOS Tricks

Start smartOS VM from iso that is in /zones/UUID/root/ vmadm start UUID order=cdn,once=d cdrom=/FILE.iso,ide Set static vnc port Do vmadm list to get UUID vmadm update UUID_HERE vnc_port=PORT_#_HERE I love RealVNC. It works well and they have stand-alone executable here’s the LINK
MORE →

Remote Control Terminal Session Windows Server

I just learned that you can remote control terminal sessions. They call it shadowing. I’ve only done it on Windows Server 2012 r2, but was super easy. You just need to open server manager, go to remote desktop services, then collections, then QuickSessionsCollections. Then you’ll see the connections in the upper right hand corner. Once you find the one you want you right click on the session and hit Shadow. By default this will ask the user to allow, if you want to override that and allows allow you can do the following group policy change.
MORE →

XCP-NG Quick Notes

I learned about XCP-NG not to log ago and love it. It’s great and easy to use. My only issue is I guess on newer versions of Windows 10/Server 2019 they were having freezing issues. I had the issue with Windows 10. I just went with Windows 7 VMs for what I needed until they get the problem worked out. XCP-NG works great with Linux. Here are some useful commands I’ve found.
MORE →

NextCloud with Apache behind NGINX reverse proxy on CentOS

This is probably useful to figure out how to reverse proxy Apache behind NGINX, but I was finally able to get NextCloud working on NGINX with no problem I like to use NGINX as my web server because that’s what I’ve always worked with. I’ve tried a couple times to get NGINX to work with NextCloud, but it would also end up not letting me log in. I did some Googleing and I guess it has something to do with how the cache is handled in NGINX.
MORE →

Supermicro X9 Hangs on Windows 10 reboot

This data has been copied from HERE Please follow the steps below: Turn off the system completely, and turn it back on, you should be able to get back into the OS. 2)Download the following driver and extract it: https://downloadcenter.intel.com/download/22655/Intel-Chipset-Device-Software-for-HECI or my link here, this may not be the newest intel_chipset_SPS_MEI_NULL_v1.2.3.2003 Open up Device Manager View » Show hidden devices In the main window, expand System devices and look the device written exactly as “Intel(R) Management Engine Interface”
MORE →

Static IP KVM Guest

Copied from Here If you don’t want to do any configuration inside the guest, then the only option is a DHCP server that hands out static IP addresses. If you use bridge mode, that will probably be some external DHCP server. Consult its manual to find out how to serve static leases. But at least in forward modes nat or route, you could use libvirt’s built-in dnsmasqd (More recent versions of libvirtd support the dnsmasq’s “dhcp-hostsfile” option).
MORE →

Add clonezilla to Fog Project

mkdir /var/www/html/fog/cz Download iSO and extract to /var/www/html/fog/cz Go to Fog Configuration > iPXE New Menu Entry Give it a menu item name Add the below to “Parameters” :Clonezilla echo Starting CloneZilla with default options kernel http://IP/fog/cz/live/vmlinuz initrd http://IP/fog/cz/live/initrd.img imgargs vmlinuz initrd=initrd.img boot=live username=user union=overlay config components quiet noswap edd=on nomodeset nodmraid locales= keyboard-layouts= ocs_live_run=“ocs-live-general” ocs_live_extra_param="" ocs_live_batch=no net.ifnames=0 nosplash noprompt fetch=http://IP/fog/cz/live/filesystem.squashfs boot || goto MENU Now it should work.
MORE →

MySQL/MariaDB Not Securing

mysql_secure_installation doesn’t seem to work on the newest Debain After some googling I think I found what works for me. Delete anon user DELETE FROM mysql.user WHERE User=’'; delete non local root user DELETE FROM mysql.user WHERE User=‘root’ AND Host NOT IN (’localhost’, ‘127.0.0.1’, ‘::1’); drop test database DROP DATABASE IF EXISTS test; drop all other root users drop user ‘root’@’localhost’; drop user ‘root’@‘127.0.0.1’; drop user ‘root’@’::1’; create a new root user with password
MORE →

Mail Server

I ended up switching to modoboa. I’ve been very happy with it on ServerCheap. I finally set up my own mail server using a couple guides. Just putting this here for my memory. Thank you to the great people who write amazing blogs. How to set up the server When put behind cloudflare you need to add the bellow to /etc/nginx/nginx.conf in the http { location # CF set real ip set_real_ip_from 103.
MORE →

Disable SuperMicro IPMI ADMIN user

Disable ADMIN user Before doing this bit you may wish to check that the new user you added works for everything you need it to. Those things might include: ssh to [email protected] Log in on web interface at https://192.168.1.22/ Various ipmitool commands like querying power status:$ ipmitool -I lanplus -H 192.168.1.22 -U somename -a power status Password: Chassis power is on If all of that is okay then you can disable ADMIN:
MORE →

CloudFlare with nginx and plex

Add the following to the http in /etc/nginx/nginx.conf. This tells nginx where the actually IP is coming from instead of showing as cloudflare. # CF set real ip set_real_ip_from 103.21.244.0/22; set_real_ip_from 103.22.200.0/22; set_real_ip_from 103.31.4.0/22; set_real_ip_from 104.16.0.0/12; set_real_ip_from 108.162.192.0/18; set_real_ip_from 131.0.72.0/22; set_real_ip_from 141.101.64.0/18; set_real_ip_from 162.158.0.0/15; set_real_ip_from 172.64.0.0/13; set_real_ip_from 173.245.48.0/20; set_real_ip_from 188.114.96.0/20; set_real_ip_from 190.93.240.0/20; set_real_ip_from 197.234.240.0/22; set_real_ip_from 198.41.128.0/17; set_real_ip_from 2400:cb00::/32; set_real_ip_from 2606:4700::/32; set_real_ip_from 2803:f800::/32; set_real_ip_from 2405:b500::/32; set_real_ip_from 2405:8100::/32; set_real_ip_from 2c0f:f248::/32; set_real_ip_from 2a06:98c0::/29; # use any of the following two real_ip_header CF-Connecting-IP; #real_ip_header X-Forwarded-For; This is the reverse proxy file /etc/nginx/sites-available/plex.
MORE →

IPTables Fun

I found these scripts years ago and decided to use them. I might as well share them First the ipset and iptables need to be installed apt install iptables ipset Now we need to create the ipset lists ipset create drop hash:net ipset create allowHTTPS hash:net ipset create allowSSH hash:net ipset create directHTTPS hash:net ipset create google hash:net script to update files and countries. If you go to the ipdeny site you can find which countries you can add.
MORE →

VMware vSphere – How to activate Windows Server OEM licence in virtual machine

Copied from LINK PUBLIKOVÁNO 23 SRP ’17 , AUTOR: TOMAS KALABIS VMware vSphere – How to activate Windows Server OEM licence in virtual machine I have installed a Windows Server 2012 R2 with a Fujitus OEM licence on ESXi 6.5, but when i try to activate this operating system i got always an error with licence key. The solution is add following lines to the .vmx file of affected VM.
MORE →

Comments: