Skip to content

Sqlplus and the exclamation mark

I was recently shown a useful trick for sqlplus.  When you are in the sqlplus command line but want to check something on the the shell command line you can use ! to temporarily exit the sqlplus command line and run your shell command.  This is particularly useful if you are checking what a script should do and you wish to vi the script as you go.  The syntax is as follows

SQL> ! pwd

/export/home/yourname

Another useful trick whilst in the sqlplus command line is the forward slash /.  This will rerun the last sql command you ran.

Adding routes in linux

The following command will allow all ips on the subnet 1.1.1.0

/sbin/route add -net 1.1.1.0 netmask 255.255.255.0 gw 192.168.1.254

Don’t forget to add it to the sysconfig files to make it persistent.

vi /etc/sysconfig/network-scripts/route-ethX

Where X is the ethernet interface you were using.

Jaysus bleedin’ security from XKCD :)

Haha

Copying multiple files around a secure network

The unix team in my job have given us access to the boxes that we’ll be running our new software on. I like to have everything the same ( as much as possible) on the boxes I work on. Now the hardware lads got a bit lax when they were doing user set up and gave a fairly decent user environment on one of the boxes but didn’t bother with the rest of them so I decided to copy the good setup from that box to the rest. Now in the old days I’d have to use ftp and call get/put commands and all that jazz but this time I used scp

The actual command I used was
scp username@hostname:~/\{.bashrc,.bash_logout,.emacs,.bash_profile\} .

The place I found this with somemore useful examples is here. I now have the same profile everywhere I go on this particular system. If I ever get the chance I’ll have to take the best features I have over the various systems I’m on and amalgamate them.

I’ve just been thinking and maybe I did this arse about face. Maybe I should’ve set up a for loop on the node with the good setup and used scp to push the good config to the other nodes 😦

for node in ip1 ip2 ip3 ip4 ip5 ip6
do
echo $node
scp ~/\{.bashrc,.bash_logout,.emacs,.bash_profile\} username@$node:~/
echo
done

Let me know if you think it’ll work.

No such thing as bad publicity

I was taking a quick look at the register today when I noticed a story about a hack done by Anonymous/AntiSec that alledgedly obtained a load of Apple UDIDs vs Numbers and names.  The FBI have since denied it but I believe it’s PR 101 to do such things, but anyway it’s in AntiSecs court to prove what they say now.  Anyway the article made me wonder what this site pastebin.com did.  There was a further link to a story about pastebin getting not liking the attention the hackers were giving it.  Why?  I’d never heard of it until now and I’m definitely going to try it out maybe put up some of my scripts on it.  Maybe the pastebin.com CEO should employ a  PR person before he hires data scrubbers.

Passwords, pain yes but no excuse for stupid ones

Here’s a list of the 500 most popular passwords. I’m glad to see my name is just below 339 🙂 Anyway be safe out there and always use random passwords.

sudo schmudo

Below are some useful commands and links for sudo

find out what sudo permission level you have
bonstechblog> sudo -l
Password:
User bonstechblog may run the following commands on this host:
(ALL) ALL
(root) !SUDOSUDO

alter sudoers file
root> visudo

If the above doesn’t work, you’re not supposed to do this but you know …
root> vi /usr/local/etc/sudoers

sudo usage
bonstechblog> sudo
bonstechblog> sudo useradd -m somechap

xkcd sudo joke