ramblings of an IT professional
Archive for April, 2010
Can’t change your FTP password?
Apr 10th
So I just ran into a very interesting issue on an account. The client was complaining that their client could not access FTP and every time they tried to change the password, the change did not seem to “take”. After a bit of research, I figured out that apparently, the account was in a cPanel “Demo” mode, in which changing of the password sends success messages, but does not actually change the password. To repair this issue, you just need to take the following steps:
- Log into WHM as root
- Go to the “Disable or Enable Demo Mode” under “Account Functions”
- Choose the account and Press “Modify”
- Disable Demo mode!
Odd that cPanel doesn’t provide any notice that the account is in demo mode when changing the password via cPanel but I guess it’s just another one of those interesting inconstancies within cPanel.
Till next time!
Scripting IP additions in OpenVZ
Apr 7th
So I just had an interesting issue where I was trying to add 60 IPs to 30 OpenVZ instances, 2 IPs per node. I came up with the following script to do so:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | #!/bin/bash for i in `vzlist -a | grep -v CTID | awk '{print $1}'` do let k=0 for j in `cat /root/ips` do if [ $k -lt 2 ] then vzctl set $i --ipadd $j --save let k=k+1 else sed -i '1,2d' /root/ips break fi done done |
The main things to note here are the following:
- When assigning a variable a value in a for loop, you need to use “let” before declaring it
- SED can be used to remove lines just as it can be used to add and replace items in lines
- Break is not something to be afraid of!
In any case, this script might be handy for others trying to perform similar tasks so I’ll just leave it here. Feel free to modify and use this code as you please
Let me know if you have any optimizations you can think of in the comments below.