07-08-2015
Is the saved output (in the file), always the same or does the content vary?
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hello to all...this is my first post (so please go easy). :)
I feel pretty solid at expect scripting, but I'm running into an issue that I'm not able to wrap my head around. I wrote a script that is a little advanced for logging into a remote Linux machine and changing text in a file using sed.... (2 Replies)
Discussion started by: v1k0d3n
2 Replies
2. UNIX for Dummies Questions & Answers
hi, everyone:
I just wonder how to save the output of command, I mean everything, save as a string into a variable.
another question is I try to ls the details of a directory, but it works in the shell, not in the script.
for example
code: ls -ltr *se100* | grep ^- | tail -1 | awk '... (1 Reply)
Discussion started by: allenxiao7
1 Replies
3. Shell Programming and Scripting
This Expect script provides expect with a list of IP addresses to Cisco IPS sensors and commands to configure Cisco IPS sensors. The user, password, IP addresses, prompt regex, etc. have been anonymized. In general this script will log into the sensors and send commands successfully but there are... (1 Reply)
Discussion started by: genewolfe
1 Replies
4. Shell Programming and Scripting
I have an Expect script which works very well. It logs into my remote routers and runs some commands and then to the next until finished. I need two things, first I need to save the output to a file from where the log_user 1 begins.
expect << EOF
set timeout 15
#set var "exit "
match_max... (1 Reply)
Discussion started by: numele
1 Replies
5. Linux
Hi,
I'm trying to save a crontab configuration using SSH, acessing a Linux machine from a Windows desktop.
So, in the prompt I type "crontab -e", to edit crontab, and a window is opened.
But after writing the changes, I press Save button but it seems not working, because when... (1 Reply)
Discussion started by: Roger75
1 Replies
6. Shell Programming and Scripting
Hey all. Sometimes I'm tasked to change some router configs for the entire network (over 3,000 Cisco routers). Most of the time its a global config parameter so its done with a loop and an IP list as its the same configuration change for all routers. This is working OK.
However, sometimes an... (3 Replies)
Discussion started by: mrkz1974
3 Replies
7. IP Networking
Hey everyone,
I have a few question.
1. Is it possible to display cisco 'show run' output command to the application ??
2. And is there any ways to log in to the router instead of using telnet from telnet application???
Thanks in advance (0 Replies)
Discussion started by: franzramadhan
0 Replies
8. Programming
Hello C specialists,
I'm trying to write a program to read out a binary configuration file produced by a router.
But the output of Name and Value is cryptic. What's going wrong?
The structure of the binary file is very simple:
struct nvram_tuple {
char *name;
char *value;
... (5 Replies)
Discussion started by: digidax
5 Replies
9. Shell Programming and Scripting
Hi,
For some reason I was needed to ping some URL and save the output to a file through Expect script, following is a very basic of that script, but it fails everytime. When I just copied the same 'ping' line to normal Terminal and run, it runs fine. Please, help.
#!/bin/sh
spawn ping -c 3... (1 Reply)
Discussion started by: santanu4ver
1 Replies
10. Programming
I'm fairly new to scripting so this might not be possible.
I am using Expect with Cisco switches and need to capture the string after finding the expect request. For example, when I issue "show version" on a Nexus switch, I'm looking to capture the current firmware version:
#show version
... (0 Replies)
Discussion started by: IBGaryA
0 Replies
LEARN ABOUT LINUX
setregid
SETREUID(2) Linux Programmer's Manual SETREUID(2)
NAME
setreuid, setregid - set real and/or effective user or group ID
SYNOPSIS
#include <sys/types.h>
#include <unistd.h>
int setreuid(uid_t ruid, uid_t euid);
int setregid(gid_t rgid, gid_t egid);
Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
setreuid(), setregid():
_BSD_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
DESCRIPTION
setreuid() sets real and effective user IDs of the calling process.
Supplying a value of -1 for either the real or effective user ID forces the system to leave that ID unchanged.
Unprivileged processes may only set the effective user ID to the real user ID, the effective user ID, or the saved set-user-ID.
Unprivileged users may only set the real user ID to the real user ID or the effective user ID.
If the real user ID is set or the effective user ID is set to a value not equal to the previous real user ID, the saved set-user-ID will be
set to the new effective user ID.
Completely analogously, setregid() sets real and effective group ID's of the calling process, and all of the above holds with "group"
instead of "user".
RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately.
ERRORS
EPERM The calling process is not privileged (Linux: does not have the CAP_SETUID capability in the case of setreuid(), or the CAP_SETGID
capability in the case of setregid()) and a change other than (i) swapping the effective user (group) ID with the real user (group)
ID, or (ii) setting one to the value of the other or (iii) setting the effective user (group) ID to the value of the saved set-user-
ID (saved set-group-ID) was specified.
CONFORMING TO
POSIX.1-2001, 4.3BSD (the setreuid() and setregid() function calls first appeared in 4.2BSD).
NOTES
Setting the effective user (group) ID to the saved set-user-ID (saved set-group-ID) is possible since Linux 1.1.37 (1.1.38).
POSIX.1 does not specify all of possible ID changes that are permitted on Linux for an unprivileged process. For setreuid(), the effective
user ID can be made the same as the real user ID or the save set-user-ID, and it is unspecified whether unprivileged processes may set the
real user ID to the real user ID, the effective user ID, or the saved set-user-ID. For setregid(), the real group ID can be changed to the
value of the saved set-group-ID, and the effective group ID can be changed to the value of the real group ID or the saved set-group-ID.
The precise details of what ID changes are permitted vary across implementations.
POSIX.1 makes no specification about the effect of these calls on the saved set-user-ID and saved set-group-ID.
SEE ALSO
getgid(2), getuid(2), seteuid(2), setgid(2), setresuid(2), setuid(2), capabilities(7)
COLOPHON
This page is part of release 3.27 of the Linux man-pages project. A description of the project, and information about reporting bugs, can
be found at http://www.kernel.org/doc/man-pages/.
Linux 2010-09-20 SETREUID(2)