I am new with linux system somehow my regular user mode changed and its became "-bash-4.1$ " also "how to switch root to regular user"? Thanks advance.
Hy All,
I have two nodes running RHEL 6.4 which are in cluster. I have clustered httpd service. Now I have certain application suppose X which reside in SAN partition. Now my job is to only automate this script to run by analyzing httpd status. I have successfully created the script apptrigger.sh whose content is given below,
-bash-4.1$ cat apptrigger.sh
a=0
b=0
c=0
d=0
a="service httpd status"
b=`eval $a`
##### CHECKING WHETHER HTTPD SERVICE IS RUNNING OR NOT #####
if [ "$b" != "httpd is stopped" ]; then
c="bash /switchapp/switch/ezlinkenterprise/bin/ezlink-cluster.sh status"
d=`eval $c`
##### CHECKING WHETHER EZ IS RUNNING OR NOT #####
if [ "$d" != "EzTaskMgr is Running" ]; then
ezstart
fi
fi
I have created this script in say test user. Now when I put this script to automate or run every minute through test user and defined its value in crontab -e of test user whose content is as shown below
$crontab -l
* * * * * /bin/bash /home/test/apptrigger.sh
but this script is running as root user so I cannot get the o/p
I think some environment variable need to be set. Anyone can guide me with this step? Thanks for your views and suggestion.
Hello Everyone,
I have a question about how to give sudo privileges to a user that log in via public key without password.
I created a normal user and I added this user to the "visudo" folder with ALL privileges.
when the user is logged in the system via public key and the user wants to become a root, a password is requested but i don't want to type the password.
Also to add the public key to the root it is not possible because i track the user log in in the system and if they log via root i cannot do that.
Thank you in advance.
user="john bob randy susan"
I extracted local user list as: cat /etc/passwd | cut -d ":" -f1
Now I need to write a script to find the difference in user between these two (users defined as above and local user). I tried many ways its not working. Any help
#!/bin/bash
users="john bob randy susan"
luser=`/bin/cat /etc/passwd | cut -d ":" -f1`
......
....
Thank you
I have created a new user with "useradd" than changed the password with "passwd" (logged in as an administrator). After that I tried to login as the new user but couldn't. Error message was: "call to lnusertemp failed (temporary directories full?). Check your installation".
I currently use Debian 8.
I checked the home directory and couldn't find a new created folder for the new user (wasn't supposed to be done automatically by useradd?) and I checked the etc/password and there was the new user name inside it though.
What should I do? I really need to have more than one user on this computer...
I am looking to display the w (who) command to show only the
User TTY IDLE
http://screencast.com/t/vXb74kguJ
13:15:38 up 8 days, 16:48, 47 users, load average: 1.47, 0.95, 0.51
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
rf3 pts/0 192.168.11.72 05:58 48.00s 6.60s 0.00s -bash
user21 pts/1 192.168.21.177 04:32 8:41m 0.05s 0.00s -bash
user7 pts/2 192.168.11.114 17Mar15 6days 1.07s 0.00s -bash
user7 pts/3 192.168.11.114 20Mar15 4:54m 9.75s 0.00s -bash
user6 pts/4 192.168.11.85 11:02 7.00s 55.58s 0.01s -bash
user14 pts/5 192.168.11.183 05:06 29:08 2.80s 0.01s -bash
user14 pts/6 192.168.11.155 05:30 13:28 2.75s 0.00s -bash
user23 pts/7 192.168.11.62 05:48 25:09 0.95s 0.00s -bash
rf5 pts/8 192.168.11.118 05:58 6:51 5.30s 0.01s -bash
user2 pts/9 192.168.11.140 08:34 1:19 44.74s 0.00s -bash
user14 pts/10 192.168.11.141 06:02 12:14 9.46s 0.00s -bash
rf12 pts/12 192.168.11.69 06:02 2:07 9.44s 0.00s -bash
root pts/13 localhost.locald 12:29 9:10 0.05s 0.05s -bash
rf6 pts/14 192.168.11.79 06:04 14.00s 9.05s 0.00s -bash
user14 pts/15 192.168.21.113 06:23 11:29 1.71s 0.00s -bash
user5 pts/16 192.168.11.126 06:24 6:56 4.59s 0.00s -bash
user5 pts/17 192.168.11.126 06:25 6:19 31.59s 0.01s -bash
user11 pts/18 192.168.11.125 06:26 28:10 2.90s 0.01s -bash
user12 pts/19 192.168.21.123 06:35 13:16 0.88s 0.00s -bash
rf7 pts/20 192.168.11.80 06:35 2:06 7.64s 0.00s -bash
user12 pts/21 192.168.21.123 06:36 41:55 0.12s 0.00s -bash
So far I have this
w | awk {'printf ("6s\ts\n", $1, $2, $3, $5)'} |more
13:20:16 up
USER TTY
rf3 pts/0
user21 pts/1
user7 pts/2
user7 pts/3
user6 pts/4
user14 pts/5
user14 pts/6
user23 pts/7
rf5 pts/8
user2 pts/9
user14 pts/10
rf12 pts/12
root pts/13
This only shows the 2 columns
w |awk '{print $1, $2, $3, $5}'
13:21:01 up 8 16:53,
USER TTY FROM IDLE
rf3 pts/0 192.168.11.72 20.00s
user21 pts/1 192.168.21.177 8:46m
user7 pts/2 192.168.11.114 6days
user7 pts/3 192.168.11.114 4:59m
user6 pts/4 192.168.11.85 3:42
user14 pts/5 192.168.11.183 34:31
user14 pts/6 192.168.11.155 18:51
user23 pts/7 192.168.11.62 30:32
rf5 pts/8 192.168.11.118 12:14
user2 pts/9 192.168.11.140 1.00s
user14 pts/10 192.168.11.141 17:37
rf12 pts/12 192.168.11.69 30.00s
This shows some what hard to read and the columns don't line up correctly
is there a way to tab them in to columns that line up properly, or even something similar to the TOP command where the list will keep refreshing?
So I created this big script and want to ask for username and set a variable, however if the username exist in the username variable then continue with script otherwise ask the user to enter his name.
Flow:
-- start script "Enter User Name"
-- ask user to input username
-- if username is blank or different value then put that username in $USERNAME variable
-- then continue with the rest of the script
-- next time this user runs the script it will have his name loaded so he just presses enter to continue with the script.
-- If it is NOT the same user then, new user can erase existing input and enter a new name.
Hope it makes sense...
Thanks in advance for the help.
hello,i want to create multi users for login in samba ! example user "one" is rw ,user "two" is r,user "three" is rwx.a was already create 2 user with difrent permission but not with 3 user,please help!
I have a script which reads a controller ID and continues. I am trying to add some checks for user input "ctrl".
Valid responses would be whole number 1 thur 5. If value is between 1-5 (single numeric value) then continue with the rest of the script. If any other value then Exit script or continue to ask user input until valid.
I tried a couple of while loops do with esac, but can not seem to get a handle
Code:
read -p "Controller ID#: " ctrl
Any help would be greatly appreciated
Dear All
I need your help.
I want to get a file from windows server using ftp.
Below is the script I have created but the connection is not established:
#!/bin/sh
lcd "directory in linux server"
USER="username of windows server"
PASS="password"
ftp -n "ip of windows server" <<EOF
user $USER $PASS
cd "C:\Users... directory in windows server where file is located"
bin
get test1234.txt
bye
EOF
I hope somebody can help me!
BR,
Hello,
In debian I created a new user "myUser".
In /home/myUser/.profile
I added "mysql -u user -password"
So automatically after login to linux terminal the user is logged in mysql command line.
What I need to do is to exit terminal after user exit mysql, so he want have access to comand line.