Friday, August 29, 2014

ORACLE: How do I set up passwords to NEVER expire?


Run the below query to set up SYSTEM password never expire

SQL> select profile from dba_users where username = 'SYSTEM';
PROFILE
--------------------------
DEFAULT

SQL> alter profile DEFAULT limit password_life_time unlimited;

Profile altered.


After doing this...Reset the password of the user again.

SQL> alter user SYSTEM identified by new-password;

User altered.

By doing this,the password will never expire.

Saturday, August 2, 2014

Docker tricks and tips

https://gist.github.com/wsargent/7049221


http://stackoverflow.com/questions/17157721/getting-a-docker-containers-ip-address-from-the-host?rq=1

How to get the container's IP address ?


You can use docker inspect
Example:
> CID=$(docker run -d -p 4321 base nc -lk 4321); > docker inspect $CID -or-
> docker inspect --format '{{ .NetworkSettings.IPAddress }}' ${CID}

How to get the full container ID ?


> docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
d8e703d7e303 solidleon/ssh:latest /usr/sbin/sshd -D cranky_pare
> docker inspect -f '{{.Id}}' cranky_pare
or
> docker inspect -f '{{.Id}}' d8e703d7e303
d8e703d7e3039a6df6d01bd7fb58d1882e592a85059eb16c4b83cf91847f88e5

Where is the full container ID stored ?
It is in the host file system under /var/lib/docker/aufs/mnt/


How to copy file from host to container ?
Get full container ID as mentioned above and then use the 'cp' command from the host
> sudo cp file.txt /var/lib/docker/aufs/mnt/d8e703d7e3039a6df6d01bd7fb58d1882e592a85059eb16c4b83cf91847f88e5/root/file.txt

How to coy file from container to host ?
>docker cp d8e703d7e303:/file/path/within/container /host/path/target


Friday, August 1, 2014

How to create Docker image with OpenSSH

http://flnkr.com/2013/12/creating-a-docker-ubuntu-13-10-image-with-openssh/

I’ve posted the stephens/sshd image to the docker site and  you can download it with the command: (The root password is password.)
> docker pull stephens/sshd

To run an instance of the image as a daemon, execute:
> docker run -d -p 22 stephens/sshd

To run the image in the foreground and enter the shell, execute:
> docker run -i -t -p 22 stephens/sshd /bin/bash

To connect to the image, first find the port that was assigned to the ssh port and then connect with the ssh client:
> docker ps
> ssh root@localhost -p