Tuesday, May 16, 2006

Quickly Generate Oracle Object Grants

This quickly generates an Oracle SQL script that can be called to grant privileges to a user or role. Extend for other object types.

select 'grant execute on ' || object_name || ' to &&userOrRole;' || ' -- ' || object_type
from dba_objects where owner='&&OWNER' and object_type in ('PACKAGE', 'PROCEDURE')
union all
select 'grant select, insert, update, delete on ' || object_name || ' to &&userOrRole;' || ' -- ' ||
object_type
from dba_objects where owner='&&OWNER' and object_type in ('TABLE', 'VIEW')
/

Sunday, May 14, 2006

Unix Remote Login Without Password

This has been covered in many places, so this will be a short version. This is not using the insecure r?? commands with .rhosts.

Assume both machines have the same or similar ssh installation.

"hosthere" is where you are logged on. "hostfar" is where you want to log on.

Use an empty passphrase and default key location.
hosthere $ ssh-keygen -t dsa

Place "pub" file on hostfar in ~/.ssh as "authorized_keys2".
hosthere $ scp id_dsa.pub hostfar:.ssh/authorized_keys2

Now ssh and scp to "hostfar" should not prompt for a password.

Troubleshooting includes checking permissions of .ssh directory and files.