Sponsored Content
Top Forums Shell Programming and Scripting Login into another user from user inside script Post 302697089 by rammm on Thursday 6th of September 2012 05:15:42 AM
Old 09-06-2012
Login into another user from user inside script

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 run chmod command. Any suggestions.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

switch user inside a script

Hi, I wrote a unix script that will perform differnt tasks on bahalf of number of users. I use "sudo" to run the script. The problem is when I execute the command: su - user -c "xxx " > output_file, I get the system output header frm the su command. Is there a way to get rid of it instdead of... (2 Replies)
Discussion started by: nimo
2 Replies

2. UNIX for Dummies Questions & Answers

I create user but i cant login the user i created.

I created a user, i login as a root. I add him in the group where he can access and login as a root! I checked it in users' list and in group's list, he is there. My problem is this, I cant login using the username/account I just created! What should i do to use and login the user/account i've just... (5 Replies)
Discussion started by: jerome
5 Replies

3. Solaris

How to run a script as different user inside cronjob in solaris.

Hi , I have a shell script to perform some actions on sun solaris box . This script normally requires to be run as a different user. so, whenever i have to run this script, i need to sudo in as that user , enter the password and execute it. Now,I have to setup a cronjob to execute the script... (11 Replies)
Discussion started by: csg_user
11 Replies

4. Shell Programming and Scripting

switch user inside a script

Hi Is there any way to switch user inside a shell script? (4 Replies)
Discussion started by: ./hari.sh
4 Replies

5. Shell Programming and Scripting

Running script from other user rather than login user

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

6. UNIX for Dummies Questions & Answers

Switching user inside a shell script

Dear All, I want to switch a user inside a shell script.My current user say x and user y to whom i want to switch both have login on the same server,the one on which i want to execute my script on. "I want to do something like this su - y Password should be provided in the script itself.And... (6 Replies)
Discussion started by: navjotmannan
6 Replies

7. Shell Programming and Scripting

Switch user inside shell script

Hi, I am trying to create one script where I have to login as another user inside the script to exeute some commands How can i achieve this? Many thanks in advance. (4 Replies)
Discussion started by: prarat
4 Replies

8. Shell Programming and Scripting

How to Login as another user through Shell script from current user[Not Root]

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

9. Shell Programming and Scripting

How to login as a different user inside a shell script?

hi, i want to login as a different user inside a shell script and then call another shell script from that script. how to do that? original script : script_A.sh so when the script_A.sh is called , i want to login as a different user and then call another shell script(script_B.sh) from... (3 Replies)
Discussion started by: Little
3 Replies

10. UNIX for Advanced & Expert Users

Prevent user from creating new user from his login

Hi Experts, Need your support Redhat 6.5 I want to create a user with all(read, write, execute) privileges except that user should not be able to create any new user from his login to perform any task. (10 Replies)
Discussion started by: as7951
10 Replies
Catalyst::ActionRole::NeedsLogin(3pm)			User Contributed Perl Documentation		     Catalyst::ActionRole::NeedsLogin(3pm)

NAME
Catalyst::ActionRole::NeedsLogin - checks if a user is logged in and if not redirects him to login page SYNOPSIS
package MyApp::Controller::NeedsAuth; use Moose; use namespace::autoclean; # One needs to inherit from Catalyst::Controller in order # to get the Does('NeedsLogin') functionality. BEGIN { extends 'Catalyst::Controller'; } sub inbox : Path Does('NeedsLogin') { # Redirects to /login if not logged in my ($self, $c) = @_; $c->stash->{template} = "inbox.tt2"; return; } sub inbox : Path Does('NeedsLogin') :LoginRedirectMessage('Your custom Message') { # Redirects to /login if not logged in- } # Turn on in config MyApp->config('Contoller::Login' => { traits => ['WithRedirect'] }); DESCRIPTION
Provides a ActionRole for forcing the user to login. WRAPPED METHODS
execute If there is no logged-in user, call the login_redirect() method in the 'Login' controller with the Catalyst context object, $c, and the message specified by the ":LoginRedirectMessage('Message here')" method attribute (see the synopsis). If there is a user logged-in (i.e: "$c->user" is true), execute the body of the action as it is. SEE ALSO
CatalystX::SimpleLogin::TraitFor::Controller::Login::WithRedirect CatalystX::SimpleLogin::Controller::Login CatalystX::SimpleLogin::Form::Login AUTHORS
See CatalystX::SimpleLogin for authors. LICENSE
See CatalystX::SimpleLogin for license. perl v5.14.2 2012-07-15 Catalyst::ActionRole::NeedsLogin(3pm)
All times are GMT -4. The time now is 12:50 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy