- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Shell Scripts
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2008 07:49 AM
тАО10-10-2008 07:49 AM
Re: Shell Scripts
I have setup this user for myself.. so that I can play with scripts
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2008 07:55 AM
тАО10-10-2008 07:55 AM
Re: Shell Scripts
$ echo $SHELL
/usr/bin/ksh
$ chsh testsh /usr/bin/sh
$ echo $SHELL
/usr/bin/ksh
$ chsh testsh /usr/bin/rsh
$ echo $SHELL
/usr/bin/ksh
what ever I change the shell to but when I give the command to see the shell I always see ksh only... Am I giving the incorrect command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2008 08:00 AM
тАО10-10-2008 08:00 AM
Re: Shell Scripts
I would suggest you look at the 'rsh' manpages:
http://docs.hp.com/en/B3921-60631/sh-posix.1.html
In particular, see the section "rsh Restrictions".
and for:
> $ /usr/local/bin/sudo su-
sudo: /usr/local/etc/sudoers is mode 0666, should be 0440
...this is telling you that the permissions of '/usr/local/etc/sudoers' allows *anyone* to write to the file --- a hugh security hole! Only the owner and the group should have read permission (0440).
Regards!
...JRF...
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2008 08:03 AM
тАО10-10-2008 08:03 AM
Re: Shell Scripts
I might suggest that instead of first setting up a restricted shell for yourself, use a standard one ('/usr/bin/sh') for your account.
I also strongly urge you to reference the manpages every chance you get. There is a wealth of knowledge therein.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2008 08:35 AM
тАО10-10-2008 08:35 AM
Re: Shell Scripts
$ exit
/usr/bin/rsh: /home/vamsi/.logout: The operation is not allowed in a restricted
shell.
$"
you have set yourself up in a "restricted" shell, "rsh". man "rsh" for more info.
(see the section on "rsh Restrictions")
"$ chsh testsh /usr/bin/csh
$ echo $SHELL
/usr/bin/ksh
$ chsh testsh /usr/bin/sh
$ echo $SHELL
/usr/bin/ksh
$ chsh testsh /usr/bin/rsh
$ echo $SHELL
/usr/bin/ksh"
Well....that's how you wound up with a restricted shell.... the commands above *don't* change the current shell, only the one you get upon a login. you should see the last field of password entry for testsh changing with each execution of the command noted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-10-2008 08:28 PM
тАО10-10-2008 08:28 PM
Re: Shell Scripts
/usr/bin/rsh: /home/vamsi/.logout: The operation is not allowed in a restricted
As mentioned, why use the restricted shell?
Also, do you have a trap command on exit, "trap 0" or "trap EXIT"? I suppose you could have an alias?
$ chsh testsh /usr/bin/csh
$ echo $SHELL
/usr/bin/ksh
>but when I give the command to see the shell I always see ksh only.
Why would you expect this to work, as OldSchool says?
As documented $SHELL is only set by login(1). If you actually invoke another shell, it still won't work:
$ csh # scummy C shell
% echo $SHELL
/bin/ksh
% exit
% $
$ sh # posix shell
$ echo $SHELL
/bin/ksh
- Tags:
- scummy C shell
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2008 12:22 AM
тАО10-11-2008 12:22 AM
Re: Shell Scripts
I am giving some best practices I ever using.
- Create you shell script using vi
- Write first line the shell
#!
#exec 1>/tmp/`basename $0.log 2>&1; date; set -x
Write your code here
exit 0 #very important for successful termination
- Save and exit from the code
- Make the file chmod o+rwx, others to be executable.
- Do not use root user to play with scripts.
IMP: exec 1>/tmp/`basename $0`.log 2>&1; date; set -x
This line will create a log file /tmp/scriptname.log if you uncomment the line. Also you can write set -x to enable o/p trace and set +x to disable o/p trace.
For any further assistance feel free to ask.
Rgds
-NKG-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2008 01:11 AM
тАО10-11-2008 01:11 AM
Re: Shell Scripts
As I mentioned above, you do NOT want to do this. It lets Others write to your script. Perhaps you meant "chmod u+rwx" for User (owner)?
>exec 1>/tmp/`basename $0`.log 2>&1; ...
You should replace `` by $().
And for basename you could use only the shell:
/tmp/${0##*/}.log
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2008 01:31 AM
тАО10-11-2008 01:31 AM
Re: Shell Scripts
The mode must be
644 For readable files
755 for executables.
i.e.
chmod 644
chmod 755
-NKG-
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-13-2008 10:57 AM
тАО10-13-2008 10:57 AM
Re: Shell Scripts
- « Previous
-
- 1
- 2
- Next »