05-03-2005
login to different user completely within the script
I am trying to write a script where I would login to a userid with id and password while staying completely within the script. I am doing this in order to edit a file where I change permissions. The objective is to allow one user only to edit a file. This is what I have now.
cd $HOME/data
if [[ -f firstrun_edit ]]
then
echo "File in use by "
cat infirstrun
echo "Try again later"
exit
fi
whoami > infirstrun this is where I would login
chmod 755 firstrun
cp firstrun firstrun_bkup
mv firstrun firstrun_edit
vi firstrun_edit
mv firstrun_edit firstrun
rm -f infirstrun
chmod 555 firstrun
exit
I am also interested in using the tso edit in a second script. Does anyone know if you can do a tso command that would put you in the file in edit the same way the vi filename does? If so what is the code? I know if I just put tso where I have the vi line I will end up in the main tso screen but I am interested in being in it the same as what vi puts you in the file to edit.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi all,
what file(s) needs to be changed and in what way in order to do the following:
when user A logs onto freebsd 4.8 automaticaly he needs to start up a script a made that executes:
sets ltp0 in polling mode,
executes tn5250 keyboard mapping
starts tn5250 with the correct parameters.
... (2 Replies)
Discussion started by: termiEEE
2 Replies
2. Shell Programming and Scripting
I need some help writing a script that I can run as a cron job. I want this script to be able find all the users that have logged on to this machine since the last time the script was run (plan to run daily at 11:30pm, so everyone who logged on that day) and email me who logged on, and when.
... (2 Replies)
Discussion started by: Drewser
2 Replies
3. Shell Programming and Scripting
I want to login to server using ssh or telnet and execute one command then exit to the shell
Please let me know how to write script for this? (1 Reply)
Discussion started by: svenkatareddy
1 Replies
4. Shell Programming and Scripting
Hi,
My requirement is that i am login from ROOT in a script but when any
command is coming which is logging to sqlplus then i have to run it with normal user as only normal user have permission to connect to sqlplus .
i tried making a script like this :
#! /bin/ksh
su -... (3 Replies)
Discussion started by: rawatds
3 Replies
5. Shell Programming and Scripting
Hi all,
I would need a script to run only at the first login of a newly created user. And at the first time only. I did some googlework but unfortunatly... I made up it possibly had something to do with the bashrc file.
This script is some kind of info for the user ; with the possiblity to... (1 Reply)
Discussion started by: laurens
1 Replies
6. UNIX for Dummies Questions & Answers
Hi guys,
I'm need to write a script that runs an infinite loop to check users that login/out of a server. I'm just not sure about the syntax with while loops and whether or not you can include a nested if-statement?
Cheers
Spaulds (2 Replies)
Discussion started by: Spaulds
2 Replies
7. Emergency UNIX and Linux Support
Hi there,
I have a Debian 5.0 server that my company uses for deployment testing. This server needs to be accessed by NOC people that have no NIX knowledge whatsoever.
I am creating a bash script for a menu-based command interface for the commands they need to run on their testing routines,... (21 Replies)
Discussion started by: ppucci
21 Replies
8. Shell Programming and Scripting
I am a beginner programmer and would like to know where to start to modify the login process so that a user can login as username new password new and have it prompt user for username and password and nothing else and then create said user account on the system so they can ssh back in and login... (9 Replies)
Discussion started by: deshi
9 Replies
9. Shell Programming and Scripting
Hi Every body,
I would need a shell script program to login as different user and perform some copy commands in the script.
example: Supppose ora_toms is the active user
ora_toms should be able to run a script where user: ftptomsp pass: XXX should login through and run the commands
... (9 Replies)
Discussion started by: ujjwal27
9 Replies
10. Shell Programming and Scripting
now i have logged in username : ramesh in unix
Now i have to created script file to login into another user and have run a command inside that user and after executing the command i have to exit from that user.
Inside script, i have to login into su - ram along with password : haihow and have to... (4 Replies)
Discussion started by: rammm
4 Replies
LEARN ABOUT XFREE86
edit-patch
EDIT-PATCH(1) General Commands Manual EDIT-PATCH(1)
NAME
edit-patch, add-patch - tool for preparing patches for Debian source packages
SYNOPSIS
edit-patch path/to/patch
add-patch path/to/patch
DESCRIPTION
edit-patch is a wrapper script around the Quilt, CDBS, and dpatch patch systems. It simplifies the process of preparing and editing patches
to Debian source packages and allows the user to not have to be concerned with which patch system is in use. Run from inside the root
directory of the source package, edit-patch can be used to edit existing patches located in debian/patches.
It can also be used to incorporate new patches. If pointed at a patch not already present, it will copy the patch to debian/patches in the
correct format for the patch system in use. Next, the patch is applied and a subshell is opened in order to edit the patch. Typing exit
or pressing Ctrl-d will close the subshell and launch an editor to record the debian/changelog entry.
edit-patch is integrated with the Bazaar and Git version control systems. The patch will be automatically added to the tree, and the
debian/changelog entry will be used as the commit message.
If no patch system is present, the patch is applied inline, and a copy is stored in debian/patches-applied.
add-patch is the non-interactive version of edit-patch. The patch will be incorporated but no editor or subshell will be spawned.
AUTHORS
edit-patch was written by Daniel Holbach <daniel.holbach@canonical.com>, Michael Vogt <michael.vogt@canonical.com>, and David Futcher
<bobbo@ubuntu.com>.
This manual page was written by Andrew Starr-Bochicchio <a.starr.b@gmail.com>.
Both are released under the terms of the GNU General Public License, version 3.
DEBIAN
Debian Utilities EDIT-PATCH(1)