I have this command:
time -p sh -c 'command1; command2;'
So command1and command2 is executed and I get the real, user and sys time printed on the console.
But I want that command1; command2; is looped 10 times and then I want to get the time which is used for the two commands.
I need to switch users in a script and keep executing commands. I thought -c would help but i don't know how to use it properly nor any idea how to do this. I wrote
bash -c "su user && command arg1 arg2"
It tried to execute the command after i typed in exit.
I have two machines running Solaris 9 (192.168.2.9) and Windows XP (192.168.2.5).
I am trying to restrict an ssh-user to execute unwanted commands using ssh(commands send along with ssh command) from a remote host. So for that I am using the forced command in the authorized_keys file that will allow the ssh-user to only execute a particular command.
If I did not set this, I am able to login via ssh and sftp.
If I run the script containing su -m user service userservice start under root user, I do not need to enter the password. But when I run it under user user, it asks passwords all the time. That really bugs me. Is it supposed to ask passwords for security reasons? Is there any way I could avoid asking password if su -m user command is run under user?
hi,
I am using solaris 11 , facing problem in ftp while using ftp to connect it from other os. SCP and ssh are working fine.
I would like to execute the SC command against a network target as a different user. I need to be able to specify username and password on the commandline as well, as this is for scripting purposes. However, I see no options on SC for executing a command as another user.
I am new here so I apologize if this question is in the wrong section or outside of the realm of this board. Also, this is just my first week into shell programming so I am probably doing lots of things wrong.
I am trying to write a script to ssh to a machine as one user and then run a command as another user on the remote machine.
I've been on linux for more than 6months now but never went tooo much into CLI.
Now as I ask questions here,get answers or other help from other sites,I learn new commands..
I want to knw,is there a way,I can store every new command in a text file.Only a new command should be recorded.If repeated,should be ignored.
For example,this is what I want to happen-
1.In the terminal,I enter the comman