You can use mkstore.
Here I explained how to create one to use for PHP connection but the principal is the same
If you are connecting to a local database instance on the server, then you can do it without using a password at all. Create a user in the database like:
create user ops$<os username running scripts> identified externally
and grant privileges as appropriate. Note that ops$ is the default prefix, but you probably should check the os_authent_prefix on your database to be sure,
This will allow the user to connect locally from the server without a username of password,
[oracle@mine ~]$ id
uid=175(oracle) gid=115 groups=115,116
[oracle@mine ~]$ sqlplus /
SQL*Plus: Release 10.2.0.3.0 - Production on Fri Jun 14 09:02:39 2013
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP and Data Mining options
SQL > show user
USER is "OPS$ORACLE"