Archive for Linux
Changing Linux User Passwords
I had reason to go looking for this today, having not done it in a long, long time (thanks to the delightful cPanel interface). To change a password on behalf of a user, first sign on or “su” to the “root” account. Then type, “passwd user” (where user is the username for the password you are changing). The system will prompt you to enter a password. Passwords do not echo to the screen when you enter them. You can also change your own password, by typing “passwd” (without specifying a username). You will be prompted to enter your old password for verification, and then a new password.
Exim Cheats again!
One of my servers was subjected to a SPAM attack again yesterday (via PHP using an insecure php mail() call I suspect). Thankfully the user was tracked down quickly and suspended. Leaving some 10,000 messages on the queue!! Digging out the Exim Cheatsheet that I posted on this blog in December saved my bacon yet again! The argument for turning on PHPSuExec continues!
Hands on with an Exim Cheatsheet!
A couple of days ago I had reason to get really hands on, down and dirty with Exim my MTA. The basic problem being that for some absolutely unknown reason a couple of clients messages were stuck on the queue and not able to be delivered to me. They were failing with some reason about broken pipes: 2005-12-14 10:18:17 <MSG ID> <[email protected]>: virtual_sa_userdelivery transport output: An error was detected while processing a file of BSMTP input. 2005-12-14 10:18:17 <MSG ID> == <[email protected]> R=virtual_sa_user T=virtual_sa_userdelivery defer (0): transport filter timeout while writing to pipe Try as I might I couldn’t get them off the queue – later whilst trying to uninstall clamav/Mailscanner (which seemed to be the problem) a reboot of… Continue reading »
Linux Search and Replace
Sed can be a pain in the butt, so thanks to Shooter.net I’ve recently been changing files with perl using the following code: perl -pi -e ‘s/search/replace/g’ *.text -p Assumes an input loop around the script. It reads each line of the file and outputs it after processing -i Activates in place editing of files -e Indicates a single lines script ‘s/search/replace/g’ is the script or command. In this case it’s a search and replace regex *.text the filename(s) to operate on Extending this via some digging around I did for searching and replacing recursively through subdirectories, I found this piece of code: find . -print | egrep “*\.html” | xargs perl -pi -e ‘s/this/that/g’ This is far cleaner than… Continue reading »
Linux File Permissions
rwxrwxrwx 777 Read, Write and Execute permissions for all users. rwxr-xr-x 755 Read and Execute permissions for all users. The file’s owner also has Write permission. rwxr-x – – – 750 Read and Execute permissions for the files owner and the group; The file’s owner also has Write permission. Users who are not the file’s owner or members of the group have no access to the file. rwx- – – – – – 700 Read, Write and Execute permissions for the files owner only; All others have no access. rw-rw-rw- 666 Read and Write permissions for all users. No execute permissions to anyone. rw-rw-r- – 664 Read and Write permission to the owner and group. Read only permissions to all… Continue reading »