Programming :: Inserting Usr Into /etc/passwd Via Script?
Jan 19, 2011
I need to either locate a script that is similar to what I am needing or figure out a better way of doing what I need. I have mutiple shops with AIX unix servers, using ksh with virtual terminals that connect. since these are on an internal network we have them connecting to the server as either usr01, usr02, etc. what I need to do is add 15 user's ranging from usr01-usr15 into /etc/passwd each usr is identical in such that each line contains
Code:
usr01::0:0::/usr/tops:/bin/ksh
only difference is the usr# changes. I wrote a script where I was just adding these all to the /etc/passwd but now I have been tasked with adding them to these shops but with out any duplicates. is there any way to have a script check the file to see if the usr# exists and if so proceed to the next number and then input the usr#::0:0::/usr/tops:/bin/ksh into the file?
we know that /etc/passwd - is a replica of /etc/passwd file and acts as a backup in any damage done to /etc/passwd file..i have observed a strange thing in RHEL 5.4....for example... if /etc/passwd has 100 accounts.. then /etc/passwd - is having only 99 accounts....when i add 101 useraccount with "useradd" then /etc/passwd has 101 accounts and /etc/passwd is having the 100th account of /etc/passwd - ..when i delete /etc/passwd and recover it with /etc/passwd - from runlevel 1 the lastly created user is not having his account after recovery.. what is the solution? this is same case even with /etc/shadow and /etc/shadow -
I'm gonna replace my machine's ip address and hostname using awk command. the pattern of the file is like the following...ip address="192.168.1.100"the script must ask the ip address from the user and replace it with the ip address in the quotation.
I'm writing a C program, and using Autotools. I have a large text file that I need to include verbatim, as data for my program.I used to have a hacked-together Perl script that would take a file like this: Code: A Rabbi, a Priest, and a Minister walked into a bar.The bartender said, "What is this, a joke?" I found this site that contains instructions for doing exactly what I want, but that technique requires GNU's ld, and the whole point of using Autotools in the first place is to make my project platform- and compiler-independent.I should point out that, according to the Autotools help, I can do this with a script called either "txtc.sh" or "txtc.sh.in". Unfortunately, Google can't find such a script, and it's not in any package that I can find.
alright, i have a LFS script and im pretty sure i know how to use it correctly, the only big iff i have with it up where it says WGETLIST="" should i insert the website where all the packages are contained? and the same would be assumed for the MD5 checks as well.im just a little lost as to what should go in between the quotes.
insmod: error inserting 'kernel.ko': -1 Invalid parametersI am getting this error when i am try to insert kernel.ko into kernelMy systemfedora 12 with gcc 4.4.2insmod kernel.koinsmod: error inserting 'kernel.ko': -1 Invalid parametersmy program
I want the below line of text to be inserted in a file.Description "Linux Group" $1i am using sed "10 iDESCRIPTION "Linux Group" $1" filenamebut because of the "Linux Group" my code goes into infinite loop.Please let me know how i need to print Linux group with the double quotes in my file.
If I try and paste text from the clipboard when using vim, it automatically inserts hash at the start of every line. This is driving me mad! How to I get rid of it? Ive deleted all my .vim files/directories in my home directory.
Well we all know that it holds passwords. But cat-ing it gives out nothing. Not even encrypted gibberish. So how exactly is a password stored in this? Is this like a device file or something?
If I configure a crontab like below.12 3 12 4 4 cat /etc/passwd I know that the cat command will get executed at the configured time. But where will the output of that command go?If it is something like below, then out put will be routed to /tmp/file1.12 3 12 4 4 cat /etc/passwd > /tmp/file1
When I insert any USB device (flash drive, bluetooth device, Nokia USB data cable), my system goes in suspend mode (standby). Same thing happens when I remove the device. I have to wake up the computer by pressing a key or the power button. By the way, I don't think this ever happened in the first 3 or 4 days of installing Natty.
What command is executed when you plug in a USB Flash drive manually in the PC's USB port?I am pluggin in the device and it is automatically getting mounted in /media/ed7a753f-df88-4984-b65a-5d3a8cc2714a. After I unmount the device using umount /media/ed7a753f-df88-4984-b65a-5d3a8cc2714a, how do I remount it from the terminal so that the weird directory gets created automatically and the Flash Drive gets mounted there?Another question, where does the system get this ed7a753f-df88-4984-b65a-5d3a8cc2714a. Is it some kind of identification of the disk?
# # insert the line '-A INPUT -i eth0 -j ACCEPT' # in iptables # /-A INPUT -i eth0 -j ACCEPT/a -A INPUT -i edge0 -j ACCEPT
but when i run sed -f script iptables. it just echo's it to the the screen with my line added and not into the actual file. anyone know what i am doing wrong?
I know that Apache creates as many instances of a CGI program as required but I have no idea how those instances write to the same file in an orderly manner.For example, a CGI program called by Apache inserts additional data in a file, is that file made automatically unavailable to the other instances (children) of this CGI program while it is inserting the data? Or should the CGI program do that?
I am running Red Hat with 2.6.18-194.8.1.el5PAE kernel version. I am trying to run encryptfs to encrypt a partition on my hard drive. One of the kernel modules necessary is the md5.ko. I noticed it wasn't loaded in when doing an lsmod. I tried running modprobe md5 and it fails to load:
I was doing some experiment about resource-accessing. By mistake, I executed this command,$ sudo mv /etc/passwd /etc/passwd.bakThen I could not execute any command with privilege(eg. sudo mv /etc/passwd.bak /etc/passwd). When I shut the system down, I could not boot it any more.
I have an account on a remote Ubuntu machine. I started the vncserver on that box, it used display number 7. From my Windows machine, I connected to the remote box on port 5907. It connected, but said, "no password configured for vncauth". I noticed that the ~/.vnc/passwd file is empty, alongwith the log file. I typed vncpasswd to set the password again, but no use. I tried vncpasswd ~/.vnc/passwd as well, but no use.The VNC server is running.
/etc/passwd permissions keep getting reset to 600. When I set it to 644 as su, it eventually changes back.This occurs on my openSuse10.2 machine but not the openSuse 11.1 machine, but I assume that is irrelevant. Is there something that got tweaked that I need to change in Yast to stop this from happening?
All servers mentioned below run OpenSuSE, either 10 or 11.I am currently working on a few scripts that are meant to be used as part of a continuous integration setup. I am trying to keep these scripts reasonably secure, and so I have made sure that all the servers run these scripts only as a specific user (user1) that has permissions to basically nothing else. The problem I am currently running into is that I need to start and stop tomcat as user1 but this user doesn't have permissions to the tomcat rectory (only tomcat has execute permissions). I have a temporary workaround in place while I work on the scripts (I have an SSH key in place that allows me to SSH from user1o tomcat without a password and execute my commands that way) but it is not very secure. I have tried adding the following line to /etc/sudoers:
Code: tomcat localhost = NOPASSWD: /opt/tomcat/bin/startup.sh, /opt/tomcat/bin/shutdown.sh but it doesn't work as I expected it to. I tried a few different syntaxes for that line,
I'm running a small network of 20 PC's (slackware), I had previously used NIS and can't really be bothered with ldap it's a bit of hassle. I do not need a centralised database just a login auth system.On the server I make a folder called /sec and symlink passwd, group and shadow into it.I export this via nfs.On the workstation I create a folder /sec, move the passwd, group and shadow file into it and then symlink them back into the /etc folder.On bootup, the rc.local mounts server /sec over the top of workstation /sec. If it fails it falls back.I wasn't sure if I could just mount /sec on the workstation and then temporarily symlink group,passwd,shadow over the top of the /etc/shadow etc