UNIX ADMIN RUN COMMANDS of Other Users on the box

Posted on 2011-04-28
Last Modified: 2012-05-11
i need ideas for how to run a script that will span to run commands on different servers under different users
Question by:EmadGirgis
    LVL 16

    Expert Comment

    by:Bryan Butler
    LVL 3

    Expert Comment

    Simply, copy script to new server user, and change the permission of script with

    chmod 550

    and run your scripts.

    Note : you need to take care script environment setting like Perl etc.

    LVL 48

    Accepted Solution

    Assuming you have ssh keys set up, you could create a file with the users and servers, eg:

    user1  server1
    user2  server2

    Open in new window

    Then in your script, you do:

    while read user server
       ssh $user@$server "some comand or script"
    done <server.list

    Open in new window


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
    A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Video by: Phil
    This video goes over how to configure and start a jail in FreeBSD.  This video is meant to supplement the article included with this course.

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now