The trouble about SU ...


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers The trouble about SU ...
# 1  
Old 10-05-2005
Question The trouble about SU ...

Hi all,

having read lots of posts about SU I don't quiet understand this :

I'm doing regular backups of my database (u betta do) and therefore use su - username -c "sqlscript special data_base" in a unixscript which is even using cron. (yep!)

Now I need some other script, still with this database, to do some updates to it, nightly.

Manually, I can run the usual command (being root) as above but the problem is that I can't get out of it unless keying exit in. Even keying exit between the quotes doesn't work.

When keying exit in at commandline, I get back to my root-shell and the script is launched correctly. Smilie

Any idea would be greatfully accepted!
# 2  
Old 10-05-2005
Please show us an example of the command that does not work in your script.
# 3  
Old 10-05-2005
Ok, there you go :

As root.

su - dbuser -c "customers.exe upd_prclst"

or

su - dbuser -c "customers.exe upd_prclst;exit"

is putting me into a new shell as user dbuser.

This user then has full access to all of his environment but the prog customers.exe upd_prclst is not ran.

I then key in an exit command which puts me back to the root environment. The prog is executed ok in the dbuser shell.

I suppose there must be a CTRL-D or something missing but Smilie Smilie Smilie
# 4  
Old 10-05-2005
Look carefully at dbuser's .profile or other startup script. Does he exec a new shell or something?
# 5  
Old 10-05-2005
Ahhhaahh !!!

You are right! Smilie

Why this has been done this way ... dunno but in fact, the .profile is executing another script which is executing ksh -o vi at the end of it.
I don't know yet wheather this is important or not but I made a copy of the user and deleted the ksh command.

It works ok now.

Great!

Thanks a lot!

Smilie
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

gnuplot trouble

I am having a bit of trouble plotting a histogram in gnuplot. I am trying to use it to draw bars side by side. The first bar is from column five in my data file. The second bar is actually three bars stacked on top of each other and should be as tall as the first bar. The data is from the 2nd,... (0 Replies)
Discussion started by: kingnothing
0 Replies

2. Programming

Trouble with C

Hey, i am having a problem First, i know java well and i have used C++ on occasion so i thought i would be able to deal with a class where they program in C. unfortunately i have hit some speed bumps that i am having problems. Here is my problem: I have a structure cache_t in the sample... (0 Replies)
Discussion started by: zephoid
0 Replies

3. UNIX for Dummies Questions & Answers

trouble with awk

I am trying to figure awk. I have a file in my home directory called testawk.sh, have made it executable, and have run it... But don't see any output. This is the contents of the file: #!/usr/bin/awk -f { print " - HI -" }I enter ./testawk.sh in the prompt, press enter, and watch as the... (2 Replies)
Discussion started by: matthewden
2 Replies

4. UNIX for Dummies Questions & Answers

X trouble

Hi there, I'm new to unix-environments. I'm richard, and i'm mostly a web-developer, under php. I've done work in unix env before, but never had my own. Today, I've got debian 3.1 r4 from the official site, and i've attempted to install it twice. I installed it initially as "Desktop... (0 Replies)
Discussion started by: izua
0 Replies

5. UNIX for Dummies Questions & Answers

trouble mounting

What is the possible cause for the mount command to take ages? im trying to mount remotely : "mount -t nfs xx.x.x.x:/export/xyz/cdrom-4.0 /mnt/cdrom" on a system using bash. Im able to ping the remote server, but the system hangs or takes about half an hour to carry out this mount command.... (4 Replies)
Discussion started by: sahilb
4 Replies

6. Shell Programming and Scripting

Trouble with Backslashes

Hi folks, there are windows device names in the sixth column of a comma separated file. A example device name is: \\.\Tape0 I don't get the all string in to a variable, because of the preceding backslash. The first backslash is just cut off and my attempts to manipulate the string afterward... (0 Replies)
Discussion started by: wibo1
0 Replies

7. Solaris

Trouble with tr

I'm not sure where to post this but it's happening on a SunOS 5.8 server so I'll try here. I've discovered some unexpected behavior when using tr. For example: echo a | tr Z echo b | tr a echo a | tr B echo a | tr B echo a | tr A (8 Replies)
Discussion started by: Mike@Work
8 Replies

8. AIX

license trouble

Hi, we currently use a valisys licence : it is based on a server (serv1) it is reached only by one workstation (cam1) In all licence files there is line with cam1 et serv1 We want to use cam22 (new workstation) instead of cam1 I made a copy the licences files with remplacing cam1 by cam22... (0 Replies)
Discussion started by: cadmanager
0 Replies

9. What is on Your Mind?

The trouble with...

Welcome to "The trouble with...." with your host, ZazzyBob. Todays offering - "The trouble with letting other people host your website" I use a certain web hosting service, who shall of course remain nameless here. They are running PHP 4.3.10 I decide to write a script to test their PHP... (6 Replies)
Discussion started by: zazzybob
6 Replies

10. UNIX Desktop Questions & Answers

trouble

Hello, The system reboots in single user mode what command to use to bring the system up regularly?? I get INIT: cannot create /var/adm/utmpx Type control -d to proceede with a normal startup or give root passwd for system maintaince. either way i don't have a change and ... (1 Reply)
Discussion started by: awk
1 Replies
Login or Register to Ask a Question