General :: A Script For Deleting User , If He Has No Login Shell?
Nov 25, 2010I want to create a script to delete user if he has no login shell.
View 4 RepliesI want to create a script to delete user if he has no login shell.
View 4 RepliesI am using the sudo command to log on locally as another user by the following command:
sudo -u theotheruser -s
or
sudo -u theotheruser sh
As I see it, this initiates a new shell with the mentioned other user.However, this doesn't load that users profile from his home directory.Is there a way to automatically read the users profile when login in with selected command? I am mostely interested in getting a working prompt when logged in.
I was trying to create a shell script which will automatically login to the server 192.168.1.7 and checks if a user exists there or not, if it doesn't exist then it should create the user.I have very little idea about shell scriptThis is what I tried:Quote:
#!/bin/bash
pass="sacharje"
ssh 192.168.1.7
Now, how to pass that password automatically to the ssh when it asks for the password? (I can't use public key authentication here)
yesterday I updated my fedora 13 to fedora 14 (on laptop) and today i cannot log in on user. It just go blank for a sec and is back to login.
At text console (alt+ctr+f2/f3) i enter my username and pass it give this for a sec and resets (clean) console
username: Name
password:
last used: [date]
login: no shell permission denied
i used unetbootin (fedora 14 netinstall to update) and later i updated 1,5G before reboot (did update that fix, forgot its name tho :s)
I would most likely reinstall everything, but i have some work at laptop and as death-line is near, i would prefer to fix it if possible.
edited:
i have installed F13 on unused space, is there a way for me to access and fix it? or at least get some files from there?
I inadvertently typed the wrong path when changing my user login shell and now every time I log in I get a message stating that it can't find the shell and boots me off the system. It will then redisplay the login prompt. I'm running Ubuntu Server x64 in VMware Workstation.
View 1 Replies View RelatedI'm using VSFTPD on my office LAN for one simple task: to receive-and send - installation images created with Ghost4Linux. Until recently, my main LAN server ran on CentOS, but I decided to migrate it to Slackware (nicer release policy ).
What I usually do is create an 'install' user who can login to FTP, but not on the system. Here's an example of what I used to do on my CentOS setup:
Code:
# mkdir -p -m 0700 /home/ftp/install
# groupadd install
# useradd -d /home/ftp/install -g install -s /sbin/nologin install
# chown -R install:install /home/ftp/install
# passwd install
The relevant bits in vsftpd.conf looked like this on the CentOS server:
Code:
...
anonymous_enable=NO
...
userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd/user_list
...
Then I only had to create the /etc/vsftpd/user_list file and put a single line in it to allow the newly created user:
Code:
install Now I've tried to get the same behaviour on Slackware, and I succeeded more or less, except for one thing. There's no way my 'install' user can login to FTP when his default shell is set to '/sbin/nologin' (or '/bin/false'). Only when I change the 'install' users' default shell to a "real" shell like '/bin/bash', he's able to login.
Here's a little practical demonstration of what's happening:
Code:
$ lftp localhost
lftp localhost:~> user install
Mot de passe :
[code]...
I am a non-root user, and have made a directory into which other users in my group can write. The directory is setgid, so files and directories within it have the same group.I can delete files placed into this directory, but if a user creates a subdirectory with files in it, I can't seem to delete those. Is there something special I can do (other than, say, bothering the user in question or the sysadmin about it) to get rid of this subdirectory?
EDIT: Inevitably, of course, someone asks "why?"The shared folder in question is a mercurial repository. We can't use a shared-account ssh-key-based server for this like mercurial-server, and we can't just host it externally for various reasons. But that part works fine.We use Redmine for project management, but it does not yet read the repo index for file contents - it reads the working directory. So the working directory must be kept up-to-datecrontab has been disabled by the sysadmin, so that's out. So I naïvely put a changeset hook in the shared repo that performed an "hg update". This seemed to work fine initially, until, of course, someone pushed a commit with a new directory. While I had vague thoughts of trying to make a setuid script for the hook, I'll probably just consider safer avenues.
MACHINE: HP Proliant DL260G5OS: SLES 11 SP1kernel: Linux xserver 2.6.32.12-0.7-default #1 SMP 2010-05-20 11:14:20 +0200 x86_64 x86_64 x86_64 GNU/LinuxIt is used as remote xserver in a LAN.I have configured /usr/lib/restricted/bin/.rbashrc with some environment variables but when the users logon in the system finally is executed $HOME/.bashrc and some environment vars are overwritten.
View 2 Replies View RelatedI've looked everywhere but I can't find where to change the default box for incoming mail, or am I on the wrong track. It's a nuisance having to change folders and I can't configure wastebin to empty on exit.And I can't get kmail to import from evolution. Do I have to go to the evolution storage and do it manually, and if so, how do I do that?
View 1 Replies View Relateddiffrence between login and non login shell. What does it mean by user enviorment.
View 3 Replies View RelatedI setup linux script to delete my backups older than few days:
RBRDAN=`date �date=�3 days ago� +%w`
rm /u02/oracle/backup/rman/$RBRDAN/*
But, I got error:
[code]...
Im want to know the command to add a user with no shell access so they cannot log onto the system, but there a user on there so for example they can be part of the email server.
View 2 Replies View RelatedI have a program I want to run as it's own user. But I don't want anyone to be able to login as that user, so I created a user like: -
useradd -s /sbin/nologin someuser
How do I run a specific program owned by this user as this user? I can't su to this user as it doesn't have a shell.
Hello.I am using Opensuse 11.1 (just installed),gnome-based .My problem is,I can only login as root,cos the tty's attached to my normal user(non-privileged)keep crashing(I checked this with last).Is there any way I can fix this?I reinstalled several times,nothing to do.
View 9 Replies View RelatedHow to login as root in linux shell?
View 3 Replies View RelatedI work with a text mode debian6.0 and when I was testing some commands, I changed default shell to ash. System replied that it has not ash shell.so I thought the shell did not change. But when I start the system again and enter root password, I see a message like "can not execute ash. No such file or directory" and then system return to login page again. Root is the only user on that system.
View 11 Replies View Relatedhow can i send message to other user in shelli try use write before but it say permission deny from user
View 2 Replies View RelatedI have a big problem here.I have 2 shell windows, ne is a root shell and the other with some user account.If I change the root password in the root shell window aspasswd rootI can change it, but when I go into the user shell window, and I do "su" I cannot switch to root. Always "incorrect password".Same happen if I try to do "su <some-other-user>"This happen ONLY in shell windowws. If I try, for example, to run some administration service, like system-config-service, the root password is accepted in the prompting window.
View 6 Replies View RelatedWhen we are asked for password while booting Linux, is that the login shell ? If yes, we can't seem to be able to do anything in that shell besides typing the password. (Is it in this that the contents of /home/.profile file gets executed ? in a sigle PC)
When we click on the terminal icon for the first time, are we opening a subshell of something or a new shell altogether? If on repeatedly clicking on the terminal icon, new shells are being launched, not sub-shells, then why does export seem to work with the new shells, though its supposed to work for subshells ?
what are the two ways you can identify the PID nimber of your login shell
View 14 Replies View RelatedI heard (although I can't find any sources for proof) that the USER environment variable may not be set in a old Unix shells (maybe even some obscure shells as well). What is the probability that it won't be set?
View 2 Replies View RelatedHow to Look at history file in unix shell for a user, find 5 most often used commands.
View 5 Replies View RelatedHow we can take username from the /etc/passwd which have UID more than or equal to 500.
View 3 Replies View RelatedI have been give a task of replicating one of our production systems to create a test system. I have been restricted to use c shell to set up its environment variables. I am new to this my questions is how do i set environment variables for a particular user on c shell e.g ORACLE_HOME and ORACLE_SID permanently for a particualar user i know in bash you edit the .bash_profile file. What do i do for c shell?
View 2 Replies View RelatedI want ssh a remote server through shell script with predefines username and passwd. i dont know how to use expect command to do that.
View 4 Replies View RelatedAny one tell me online bash login using putty [ssh port] for practicing a linux.
View 6 Replies View RelatedI'm out of ideas and I want to know if someone can answer me this question:I have 15 linux servers, with the same OS, on my network and I have to delete a user (the same in all the servers) but I don't have time to do it one by one.Some know a way to do this task
View 3 Replies View RelatedCode:- '-K': Allow users to resume and upload files, but *NOT* to delete or renamethemDirectories can be removed, but only if they are empty. However,overwriting existing files is still allowed (to support upload resume) . Ifyou want to disable this too, add -r (--autorename) .This is pretty much what I want to do, but I only want this done to ONE user on the server. I have many user accounts, but only one of them I want to prevent users from issuing the "delete" command and deleting everything.
View 2 Replies View RelatedI need sudo for www (apache) user to run a shell script('ip.sh' contains iptables rules) from cgi-bin directory via browser using a per script. I edit sudoers( www ALL=(ALL) NOPASSWD: ALL ),but when run the bellow command that's with err:
# sudo -u www sh /srv/www/cgi-bin/ip.sh
iptables v1.4.4: can't initialize iptables table `filter': Permission denied (you must be root) Perhaps iptables or your kernel needs to be upgraded. And:
# ls -al ip.sh
-rwxr-xr-x 1 root root 243 Sep 7 14:18 ip.sh
I edit sudoers so
'www ALL=(ALL) NOPASSWD: /srv/www/cgi-bin/ip.sh,/usr/sbin/iptables' too. but it doesn't work too. how can I execute this script via browser ?
I'm ssh'ed into a machine and logged in as a different user. Is it possible to open a few new windows that will still be ssh'ed into that same machine, still logged in as that user?
View 2 Replies View Related