Sponsored Content
Top Forums Shell Programming and Scripting Need to run source .bashrc everytime Post 302090052 by apoorvasharma80 on Friday 22nd of September 2006 07:13:19 AM
Old 09-22-2006
Have you tried to read the man on bash? It says the bashrc file is read by the system when you open a subshell. If you want them to be set on the first place then put them in your .profile.

regards
Apoorva Kumar
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Makefile relinks everytime

Hi guys, I'm a firsttime poster. My makefile is relinking everytime, even if nothing changes. Is there anyway to have it stop doing this? Here the makefile: F77C = /usr/bin/f77 -O VERSION =9.4 VPATH = ../poten # executables that can be built from this makefile OH3S =... (10 Replies)
Discussion started by: bellings
10 Replies

2. UNIX for Dummies Questions & Answers

backing up file everytime script run and saving other backups

how would i go about creatng a backup of a file everytime a script is run so that the next time it is run the old backup gets pushed back and the most recent backup is 1st. (new)backup.1 (old)backup.2 that kind of idea?? (4 Replies)
Discussion started by: knc9233
4 Replies

3. UNIX for Dummies Questions & Answers

Why does my webserver stop everytime I exit my session?

Hi, We have a webserver which runs on our unix server, we had to stop it for some work to be carried out, and restarted it earlier this week. I'm logging in as myself and then root and starting the webserver as follows: cd /etc/init.d ./northgate.web start this starts it up fine,... (6 Replies)
Discussion started by: kenny123m
6 Replies

4. UNIX for Dummies Questions & Answers

.bashrc file is an initialization file run by each interactive invocation

I search the web and found the following statements ..... The /etc/profile file is a system wide initialization script which is run at login time for each user, while .profile is the users own login initialization. The .bashrc file is an initialization file run by each interactive invocation... (1 Reply)
Discussion started by: cy163
1 Replies

5. Programming

I have C++ exe file( no source code) and need to run many large dataset under unix, b

I have C++ exe file( no source code) and need to run many large dataset under unix, but how to know the memeroy usage for one dataset?http://www.codeproject.com/script/Forums/Images/New.gif I think "top" is not good and if using the profiler, it seems no free download, any ideas? (1 Reply)
Discussion started by: Danielwang1986
1 Replies

6. Shell Programming and Scripting

How to make a script to run everytime a new file is copied into a directory??

Hi folks I have a unix script script1 in a directory folder1 and also I have few input log files in this directory. My input log files will be copied into this directory folder1 from the portable thumb drive. Now what I want is I need to run this script1 whenever any new file is copied... (2 Replies)
Discussion started by: ks_reddy
2 Replies

7. Shell Programming and Scripting

Run Script in K Shell using Source

Hi While running a Shell Script in a K Shell using the source command source <script_name> It gives the error .. source: not found. Null message body; hope that's ok Is it that the source command does not work in K Shell. It works well in bash shell. (2 Replies)
Discussion started by: harneet2004us
2 Replies

8. UNIX for Dummies Questions & Answers

Script run everytime a new terminal window is opened

I created a script called title #!/bin/sh echo "^0;$*^G" It will change the terminal window titlebar to what ever I type after the script (title BIG would change titlebar to BIG instead of terminal) Is there a way to make it run so it will work on every terminal window that gets opened.... (1 Reply)
Discussion started by: amason0508
1 Replies

9. Shell Programming and Scripting

To move multiple files to a new folder everytime

Hi , Below is the scenario A.txt B.txt C.csv .......... i want to move all the above files in to a new path & new folder .This folder is created based on date(for ex: today's fodler name will be 20120222).for Everyday move a new folder based on date has to be created & this folder... (1 Reply)
Discussion started by: jagadeeshn04
1 Replies

10. Shell Programming and Scripting

Ksh: Test UNIX command without $? everytime

Hello all, working on Solaris 10 in ksh. Basicly, in my function, i'm trying to test that all my unix cmd's are true (exit status 0) else you flag the rcControlRule to 1 without going into spagetti mode code testing every $? in a if statement. The mdb is probably a little tricky cause it... (3 Replies)
Discussion started by: maverick72
3 Replies
AA_CHANGE_PROFILE(2)						     AppArmor						      AA_CHANGE_PROFILE(2)

NAME
aa_change_profile, aa_change_onexec - change a tasks profile SYNOPSIS
#include <sys/apparmor.h> int aa_change_profile(const char *profile); int aa_change_onexec(const char *profile); Link with -lapparmor when compiling. DESCRIPTION
An AppArmor profile applies to an executable program; if a portion of the program needs different access permissions than other portions, the program can "change profile" to a different profile. To change into a new profile, it can use the aa_change_profile() function to do so. It passes in a pointer to the profile to transition to. Transitioning to another profile via aa_change_profile() is permanent and the process is not permitted to transition back to the original profile. Confined programs wanting to use aa_change_profile() need to have rules permitting changing to the named profile. See apparmor.d(8) for details. If a program wants to return out of the current profile to the original profile, it should use aa_change_hat(2) instead. Open file descriptors are not remediated after a call to aa_change_profile() so the calling program must close(2) open file descriptors to ensure they are not available after calling aa_change_profile(). As aa_change_profile() is typically used just before execve(2), you may want to use open(2) or fcntl(2) with close-on-exec. The aa_change_onexec() function is like the aa_change_profile() function except it specifies that the profile transition should take place on the next exec instead of immediately. The delayed profile change takes precedence over any exec transition rules within the confining profile. Delaying the profile boundary has a couple of advantages, it removes the need for stub transition profiles and the exec boundary is a natural security layer where potentially sensitive memory is unmapped. RETURN VALUE
On success zero is returned. On error, -1 is returned, and errno(3) is set appropriately. ERRORS
EINVAL The apparmor kernel module is not loaded or the communication via the /proc/*/attr/current file did not conform to protocol. ENOMEM Insufficient kernel memory was available. EPERM The calling application is not confined by apparmor. EACCES The task does not have sufficient permissions to change its domain. EXAMPLE
The following example shows a simple, if contrived, use of aa_change_profile(); a typical use of aa_change_profile() will aa_change_profile() just before an execve(2) so that the new child process is permanently confined. #include <stdlib.h> #include <string.h> #include <sys/apparmor.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <stdio.h> #include <unistd.h> int main(int argc, char * argv[]) { int fd; char buf[10]; char *execve_args[4]; printf("Before aa_change_profile(): "); if ((fd=open("/etc/passwd", O_RDONLY)) < 0) { perror("Failure opening /etc/passwd"); return 1; } /* Confirm for ourselves that we can really read /etc/passwd */ memset(&buf, 0, 10); if (read(fd, &buf, 10) == -1) { perror("Failure reading /etc/passwd"); return 1; } buf[9] = ''; printf("/etc/passwd: %s ", buf); close(fd); printf("After aa_change_profile(): "); /* change profile to the "i_cant_be_trusted_anymore" profile, which * should not have read access to /etc/passwd. */ if (aa_change_profile("i_cant_be_trusted_anymore") < 0) { perror("Failure changing profile -- aborting"); _exit(1); } /* confirm that we cannot read /etc/passwd */ execve_args[0] = "/usr/bin/head"; execve_args[1] = "-1"; execve_args[2] = "/etc/passwd"; execve_args[3] = NULL; execve("/usr/bin/head", execve_args, NULL); perror("execve"); _exit(1); } This code example requires a profile similar to the following to be loaded with apparmor_parser(8): profile i_cant_be_trusted_anymore { /etc/ld.so.cache mr, /lib/ld-*.so* mrix, /lib/libc*.so* mr, /usr/bin/head ix, } The output when run: $ /tmp/change_p Before aa_change_profile(): /etc/passwd: root:x:0: After aa_change_profile(): /usr/bin/head: cannot open `/etc/passwd' for reading: Permission denied $ If /tmp/change_p is to be confined as well, then the following profile can be used (in addition to the one for 'i_cant_be_trusted_anymore', above): # Confine change_p to be able to read /etc/passwd and aa_change_profile() # to the 'i_cant_be_trusted_anymore' profile. /tmp/change_p { /etc/ld.so.cache mr, /lib/ld-*.so* mrix, /lib/libc*.so* mr, /etc/passwd r, # Needed for aa_change_profile() /usr/lib/libapparmor*.so* mr, /proc/[0-9]*/attr/current w, change_profile -> i_cant_be_trusted_anymore, } BUGS
None known. If you find any, please report them at <http://https://bugs.launchpad.net/apparmor/+filebug>. Note that using aa_change_profile(2) without execve(2) provides no memory barriers between different areas of a program; if address space separation is required, then separate processes should be used. SEE ALSO
apparmor(7), apparmor.d(5), apparmor_parser(8), aa_change_hat(2) and <http://wiki.apparmor.net>. AppArmor 2.7.103 2012-06-28 AA_CHANGE_PROFILE(2)
All times are GMT -4. The time now is 09:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy