Sponsored Content
Top Forums Shell Programming and Scripting How to scp File from root user in one server to say crt user in another server and avoid password? Post 302914851 by bitlord on Thursday 28th of August 2014 11:10:22 AM
Old 08-28-2014
I do this all the time.
If you have your ssh keys and ssh agent setup, then this will be easy.
You will also need to use sudo.

Code:
ctr@abc> sudo scp filename ctr@hfg:/location

.
or
Code:
ctr@hfg> sudo scp ctr@abc:/fileame /location

I hope this helps

Last edited by rbatte1; 08-28-2014 at 12:57 PM.. Reason: Spelling
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Dowloading a File from FTP Server to a local Server where User Id's are different

Hi, The Setup is like this. I'm connecting to Unix machine from my local machine. After connecting to Unix M/c, i need to connect FTP server. Am successful in connecting to FTP server, but am not able to download the file from the ftp server to my local machine. I have different user id's and... (1 Reply)
Discussion started by: ranjith_taurean
1 Replies

2. Shell Programming and Scripting

scp file to another server without asking for password

hi I tried reading some of the threads w.r.t scp/sftp file to another server in the same network without asking for password while copying files.....but couldnot succeed. i have generated the public key for the system using "ssh-keygen -t " and kept it in the .ssh/authorized_keys file. ... (8 Replies)
Discussion started by: aemunathan
8 Replies

3. Shell Programming and Scripting

[SSH] Need to connect to remote server as different user and without password

I have a task requiring that USER_A run a script, which connects to HOST_B as USER_B and does not ask for a password. If I am logged in on HOST_A as USER_B, I can connect to HOST_B without a password, no problem. However, if I try running ssh with the command line "ssh USER_B@HOST_B" while... (3 Replies)
Discussion started by: Totengraber
3 Replies

4. UNIX for Dummies Questions & Answers

How to avoid logging with root user?

I have created a linux machine and installed some softwares on it with root user privileges . I used to login with root user credentials for doing the various task. Later i have realise that this is not the best practice to follow and there should be a new user with less privileges to be created... (1 Reply)
Discussion started by: pinga123
1 Replies

5. Linux

How do I run HTTP server on port 80 using a non root user?

Hi experts, I want to run HTTP server on port 80, I learn from somewhere that it MUST not be run as root for security reason, how to do that? Thank you in advance! (14 Replies)
Discussion started by: kevintse
14 Replies

6. Shell Programming and Scripting

How to give user name and password in a single command to login to remote server

Hello All, I'm new to unix and i need the below favour from you. I have list of 50 unix server. I need to login to all the server one by one and with the same user and password. I will declare the user name and password globally in the script. for example : servername- hyperV user name... (4 Replies)
Discussion started by: Hari A
4 Replies

7. UNIX for Dummies Questions & Answers

Terminate scp when user not enter the password.

Hi All, Is there any way to terminate scp command when the password was not entered for some specific amount of time. (1 Reply)
Discussion started by: Girish19
1 Replies

8. Shell Programming and Scripting

I want to scp file from one server to another, both server have different user name and

i want to scp file from one server to another. both server have different user name and it needs to give password to transfer file.how can we mention password in the script itself so that we need not mention password while running the script. Say from servers cpli with user abc and file path /opt... (7 Replies)
Discussion started by: Moon1234
7 Replies

9. UNIX for Advanced & Expert Users

Setup Samba Server to always ask user and password

How do I setup a Samba server to always ask to user and password, when a windows user, prints your files using a shared printer through a Samba Linux Server (CUPS)? (0 Replies)
Discussion started by: viga
0 Replies
PMC(9)							   BSD Kernel Developer's Manual						    PMC(9)

NAME
pmc, pmc_get_num_counters, pmc_get_counter_type, pmc_save_context, pmc_restore_context, pmc_enable_counter, pmc_disable_counter, pmc_counter_isrunning, pmc_counter_isconfigured, pmc_configure_counter, pmc_get_counter_value, pmc_accumulate, pmc_alloc_kernel_counter, pmc_free_kernel_counter, pmc_start_profiling, pmc_stop_profiling, PMC_ENABLED -- Hardware Performance Monitoring Interface SYNOPSIS
#include <sys/pmc.h> int pmc_get_num_counters(void); int pmc_get_counter_type(int ctr); void pmc_save_context(struct lwp *l); void pmc_restore_context(struct lwp *l); int pmc_enable_counter(struct lwp *l, int ctr); int pmc_disable_counter(struct lwp *l, int ctr); int pmc_counter_isrunning(struct lwp *l, int ctr); int pmc_counter_isconfigured(struct lwp *l, int ctr); int pmc_configure_counter(struct lwp *l, int ctr, struct pmc_counter_cfg *cfg); int pmc_get_counter_value(struct lwp *l, int ctr, int flags, uint64_t *pval); int pmc_accumulate(struct lwp *l_parent, struct lwp *l_exiting); int pmc_alloc_kernel_counter(int ctr, struct pmc_counter_cfg *cfg); int pmc_free_kernel_counter(int ctr); int pmc_start_profiling(int ctr, struct pmc_counter_cfg *cfg); int pmc_stop_profiling(int ctr); int PMC_ENABLED(struct lwp *l); DESCRIPTION
Provides a machine-independent interface to the hardware performance counters which are available on several CPU families. The capabilities of these counters vary from CPU to CPU, but they basically count hardware events such as data cache hits or misses, branches taken, branched mispredicted, and so forth. Some can interrupt the processor when a certain threshold has been reached. Some can count events in user space and kernel space independently. The pmc interface is intended to allow monitoring from within the kernel as well as monitoring of userland applications. If the hardware can interrupt the CPU in a specific implementation, then it may also be used as a profiling source instead of the clock. IMPLEMENTATION NOTES
All function calls in this interface may be defined as cpp(1) macros. If any function is not implemented as a macro, its prototype must be defined by the port-specific header <machine/pmc.h>. Counters are numbered from 0 to N-1 where N is the number of counters available on the system (see pmc_get_num_counters() below). Upon a process fork, implementations must o Zero performance counters for the new process, and o Inherit any enabled performance counters. DATA TYPES
Each implementation must specify two new types: pmc_evid_t An integer type which can contain the event IDs for a given processor. pmc_ctr_t An integer type defining the value which may be contained in a given counter register. Counters are configured with the struct pmc_counter_cfg. This structure is defined as struct pmc_counter_cfg { pmc_evid_t event_id; pmc_ctr_t reset_value; uint32_t flags; }; flags are currently unused. FUNCTIONS
pmc_get_num_counters(void) Returns the number of counters present on the current system. Valid values for ctr in the interface entry points below are from zero to one less than the return value from this function. pmc_get_counter_type(int ctr) Returns an implementation-dependent type describing the specified counter. If ctr is specified as -1, returns a machine-dependent type describing the CPU or counter configuration. For example, on an ia32 architecture, it may distinguish between 586-, 686-, and K7-style counters. pmc_save_context(struct lwp *l) Saves the PMC context for the current process. This is called just before cpu_switch(9). If there is kernel PMC state, it must be maintained across this call. pmc_restore_context(struct lwp *l) Restores the PMC context for the current process. This is called just after cpu_switch(9) returns. If there is kernel PMC state, it must be maintained across this call. pmc_enable_counter(struct lwp *l, int ctr) Enables counter ctr for the specified process. The counter should have already been configured with a call to pmc_configure_counter(). This starts the counter running if it is not already started and enables any interrupts, as appropriate. pmc_disable_counter(struct lwp *l, int ctr) Disables counter ctr for the specified process. This stops the counter from running, and disables any interrupts, as appropriate. pmc_counter_isrunning(struct lwp *l, int ctr) Returns non-zero if the specified counter in the specified process is running or if the counter is running in the kernel. pmc_counter_isconfigured(struct lwp *l, int ctr) Returns non-zero if the specified counter in the specified process is configured or if the counter is in use by the kernel. pmc_configure_counter(struct lwp *l, int ctr, struct pmc_counter_cfg *cfg) Configures counter ctr according to the configuration information stored in cfg. pmc_get_counter_value(struct lwp *l, int ctr, int flags, uint64_t *pval) Returns the value of counter ctr in the space pointed to by pval. The only recognized flag is PMC_VALUE_FLAGS_CHILDREN which speci- fies that the returned counts should be accumulated values for any exited child processes. pmc_accumulate(struct lwp *l_parent, struct lwp *l_exiting) Accumulates any counter data from the exiting process p_exiting into the counters for the parent process p_parent. pmc_alloc_kernel_counter(int ctr, struct pmc_counter_cfg *cfg) Allocates counter ctr for use by the kernel and configures it with cfg. pmc_free_kernel_counter(int ctr) Returns counter ctr to the available pool of counters that may be used by processes. pmc_start_profiling(int ctr, struct pmc_counter_cfg *cfg) Allocates counter ctr for use by the kernel for profiling and configures it with cfg. pmc_stop_profiling(int ctr) Stops profiling with counter ctr. PMC_ENABLED(struct lwp *l) Returns non-zero if the given process or the kernel is using the PMC at all. SEE ALSO
pmc(1), pmc_control(2), pmc_get_info(2) HISTORY
The pmc interface appeared in NetBSD 2.0. AUTHORS
The pmc interface was designed and implemented by Allen Briggs for Wasabi Systems, Inc. Additional input on the pmc design was provided by Jason R. Thorpe. BSD
May 14, 2010 BSD
All times are GMT -4. The time now is 04:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy