- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- sh: ls: Execute permission denied.
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
тАО02-16-2008 08:51 AM
тАО02-16-2008 08:51 AM
Executing the following command gives the error in the Subject:
# su - a_user ls
a_user can, of course, properly execute ls, when "logged in" via
# su - a_user
Thanks
Peter
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2008 09:08 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2008 11:33 AM
тАО02-16-2008 11:33 AM
Re: sh: ls: Execute permission denied.
I just wonder how arguments with spaces can be then passed to su. Using perhaps double quotes?
Thanks
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2008 12:17 PM
тАО02-16-2008 12:17 PM
Re: sh: ls: Execute permission denied.
> I just wonder how arguments with spaces can be then passed to su. Using perhaps double quotes?
Yes. For example:
# su - a_user -c 'grep "RFC 1078" /etc/services|more'
...or:
# su - root -c "grep 'RFC 1078' /etc/services|more"
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2008 12:25 PM
тАО02-16-2008 12:25 PM
Re: sh: ls: Execute permission denied.
Thanks
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2008 01:34 PM
тАО02-16-2008 01:34 PM
Re: sh: ls: Execute permission denied.
Do you want use a variable from the current environment?
That's just normal substitution:
$ export test="/tmp"
$ echo $test
/tmp
$ su - hein -c "ls $test"
:
Or do you want to use a variable as defined in the profile for the user switch to? Like a $ORA_HOME or such?
Then you have to make sure the ${symbol_name} is not picked up by the current shell. Two basic ways, as indicated before. Which one is best, depends on how many other variables are used:
$ grep my_name ~hein/.profile
export my_name="Hein van den Heuvel"
:
$ su - hein -c 'echo "my name is " $my_name'
my name is Hein van den Heuvel
:
$ su - hein -c "echo 'my name is ' \$my_name"
my name is Hein van den Heuvel
:
hth,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО02-16-2008 02:42 PM
тАО02-16-2008 02:42 PM