All Questions
69
questions
0
votes
1
answer
486
views
How do I prevent systemd from running my timer after reboot
I have the following oneshot service+timer :
$ systemctl cat stop_syncro.service stop_syncro.timer
# /usr/local/lib/systemd/system/stop_syncro.service
[Unit]
Description=Service d_arret de la Synchro
...
0
votes
0
answers
114
views
cannot run command on Centos7
I've got a vps using Centos, the release version is 7.9. I've install the unhide in my vps.it does not work.
I've check the permission, and the file type.
but i still cant run this command . it's ...
1
vote
2
answers
1k
views
RPM none-zero exit code if a package is already installed
I created a new script to install a few local packages on CentOS 7 without internet. I want script exits upon any error
set -e
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
rpm --import ./RPM-GPG-...
0
votes
1
answer
129
views
Getting a Particular Binary Package from A Source Package?
(Sorry if the title is worded incorrectly - I am a newbie in this domain, so please correct me wherever I am wrong)
From https://packages.ubuntu.com/source/bionic/amd64/hdf5, I am trying to get the ...
0
votes
0
answers
223
views
Issue with add Multiple user account and SSH key using Bash script
As per our requirement we provided our devloper group: devs:r-x to /var/log/httpd directory.
What is the best way to create a user account (in my case Dev User) in a Group using bash scrip, with the ...
0
votes
1
answer
1k
views
How can I correctly run a java batch application (a .jar application) in background on a Linux machine?
I am not a system engineer (I am a software edeveloper).
I have to run a Java application (a runnable .jar file) on a Linux machine (Centos 7). I am connecting to a shell via SSH.
This application is ...
0
votes
0
answers
273
views
How to view or record user's active time in Linux server
I'm a server admin for a university, and we have 4 CentOS servers that students can use for their projects in various classes. The CS professors have asked me to come up with a way to track a user's ...
0
votes
2
answers
90
views
How to delete any archives older than W weeks, but still keep up to N archives?
I have a CentOS 7 directory that gets filled with tar.gz archives for different packages, where each package can create multiple archive versions.
I'm trying to find a way to delete any archives ...
0
votes
1
answer
439
views
How to call .bash_logout on CentOS
I'm trying to call my own .bash_logout on CentOS when a user logs out. However, even when an 'exit' command is sent, .bash_logout is NOT called/executed (it just logs out).
On CentOS, when I type '...
0
votes
1
answer
133
views
Dos2unix different behavior on macos and centos?
I have a file which I need to convert to unix format, so I am doing dos2unix filename.txt. But the format of the file after conversion is different on CentOS when compared to the macOS format.
I have ...
0
votes
1
answer
226
views
Jenkins service user to restart mongodb service
Centos 7.
Usually when I would like to run a sudo command as a non root user, I open up the visudo, and add this line to the right place:
%<userGroup> ALL= NOPASSWD: <command>
when I ...
0
votes
2
answers
44
views
How can I empty files at the same time with same paths?
I have a structure like this:
Father:
├───Charlie
│ └───lang.log
├───Ava
│ └───lang.log
├───Sophia
│ └───lang.log
...
I would like to clean up the scheme. I try:
cat /dev/null > Father/*...
0
votes
1
answer
1k
views
Deleted /usr/bin/docker on CentOs
I wanted to uninstall docker from my CentOs Machine and run this script :
curl -sSL https://get.docker.com/ | sh
But it told me that the docker command was already available on the system and it ...
0
votes
1
answer
805
views
CentOS - Path shows /usr/local/bin but installer shows path error
I'm trying to install heroku on a virtual machine running CentOS. When I use
curl https://cli-assets.heroku.com/install.sh | sh
I get an error message saying that my path does not include /usr/local/...
0
votes
1
answer
622
views
Return to ec2-user from a custom user
When creating an ec2 instance I use a bootstrap script. On the instance I install and configure an nginx web server. For security reasons, I need to create a new user (www-data).
The www-data user ...
1
vote
2
answers
2k
views
IPTables - Allow (ACCEPT) specific IPs within a blocked (DROP) subnet
I'm fairly new to IPTABLES, but I've written a script that blocks several of Amazon EC2's IP ranges from an input file, blacklist.txt:
...
54.66.0.0/16
54.67.0.0/16
...
I also have a separate ...
2
votes
4
answers
4k
views
Cannot chroot /mnt/sysimage After Putting New Image on HP Computer
I am using Clonezilla to put a new CentOS 7 image on our computers. Most of them are Lenovo desktops, and we have a few HP desktops that are all currently running the old image.
In order for the new ...
0
votes
1
answer
457
views
What is the behavior of mv on /?
One of our users accidentally performed mv /* ../ without root permission. After checking the effects using diff I was surprised to find that mv apparently functioned as cp when applied to the / dir.
...
1
vote
1
answer
3k
views
upload file to ftp using bash script Linux
I know this is a pretty simple question but unfortantly I can't find any solution for my problem.
I have file called: x.txt inside the root directory /x.txt.
And I want to upload the file into my ...
0
votes
1
answer
436
views
Run jpegoptim in a cronjob once a week, on CentOS from within cPanel, only for files added within the past week?
I've installed jpegoptim and can manually run it via the SSH command line:
jpegoptim *.jpg --strip-all
I'd like to take that command line and put it into a Cronjob that runs once a week. I'm running ...
0
votes
1
answer
243
views
Why is this simple cronjob not running and how do I check the relevant log files?
I have an 'R' script that I wish to run at 00:30 every day, that is, 12:30 AM everyday. The script itself is located in ~/Desktop/foldername/runme.r and which Rscript tells me that the exact path to ...
0
votes
2
answers
1k
views
cron job on centOS 6.5
I have used these 2 references to insert a new crontab entry.
redhat
ubuntu
I have created a new bash file and moved it to /usr/bin. That sh file has execute permissions for the root user and the ...
2
votes
1
answer
7k
views
Linux - create screen as another user
I'm trying to create a new screen on my server (CentOS 5.11), but instead of starting it with my user, I would prefer to use another user with restricted permissions, just to be on the safe side.
So, ...
5
votes
1
answer
10k
views
Whitelisting commands a user can use with sudo
I've been attempting to set up a whitelist of commands a user can run on my system. The server I'm using is running CentOS 7. What is the syntax that should be used to only allow a certain group of ...
2
votes
1
answer
6k
views
bash: /home/user/.bashrc: Permission denied when try to change user from root to user
I'm on centos, when I login as root and use su x to change user to x, it shows this:
bash: /home/x/.bashrc: Permission denied
I try to source ~/.bashrc but nothing changes and I also tried following ...
1
vote
0
answers
51
views
CentOS - using PXE to install it on my host ( kickstart configuration )
I am trying to install an OS from our server through PXE ( Preboot Execution Environment ).
However, on my host, I have two disks say A ( /dev/sda ) and B ( /dev/sdb )
The default installation path ...
2
votes
1
answer
122
views
Running a process in the background using &
I have created the following script:
#!/bin/bash
while :
do
echo "1" >> test.txt
sleep 1
done
If I run the command using ./exm.sh & it runs on the background as expected and it ...
-1
votes
2
answers
293
views
formatting output in bash shell to remove special characters - linux
I am issuing the command below against a logfile
grep "Oracle Audit" /var/adm/messages | awk '{print $6}'
How do I format the below output
Audit[9460]:
Audit[10507]:
Audit[10507]:
Audit[10507]:
to ...
0
votes
1
answer
12k
views
-bash-4.2$ for command line?
I don't know why when I SSH with putty onto my VPS, my command line starts with: -bash-4.2$ It hasn't ever been like that, it was myname@localhost
Only thing I have done different in the last 24 ...
1
vote
1
answer
474
views
redirection - why it doesn't work this way
I know there are 3 streams attached to a process when it is run namely the input, output and error stream.
And redirection execution work from left to right.
I intend to execute a command, redirect ...
4
votes
2
answers
4k
views
bash script.sh vs ./script.sh vs #shebang
Assuming i am in a bash shell now and i execute the following
[me@server]$ bash script.sh
q1) Is a new child bash process created to execute the script ?
If i do a
[me@server]$ ./script.sh
q2) ...
1
vote
1
answer
5k
views
Error with command cut: the delimiter must be a single character
I am trying to run this command from console:
# HTTPDUSER=`ps aux | grep -E '[a]pache|[h]ttpd|[_]www|[w]ww-data|[n]ginx' | grep -v root | head -1 | cut -d\ -f1`
But got this error:
Try `cut --...
4
votes
1
answer
651
views
What does chmod 7760 <directory> do in CentOS 7 bash?
I typed the command chmod 7760 by accident. I meant to type chmod 770 and now I'm curious what the first command did exactly.
After typing chmod 7760 , I typed ls -Al and the directory name was ...
0
votes
1
answer
2k
views
How do I run Asterisk as user other than root?
I compiled Asterisk 11 from source as user root on CentOS. Now I want Asterisk to run as user asterisk group asterisk. I have uncommented
AST_USER="asterisk"
AST_GROUP="asterisk"
in
/etc/sysconfig/...
2
votes
1
answer
2k
views
Prompt for values until press ENTER key with empty value
I'm working in a bash script for automatize some tasks. This is what I have done until now:
#!/usr/bin/env bash
PS3='Please enter your choice: '
options=("Create new group" "Add users to group" "...
0
votes
1
answer
376
views
CentOS bashrc function to email on login
I've a system setup where an email is sent on a user login (line from .bashrc):
printf "user details, ip etc" | mail -s "[LOGIN NOTICE] `hostname` - `whoami`" <admin>@<domain>.co.uk
...
1
vote
3
answers
26k
views
Allowing another user to execute program?
I want to allow a particular user to execute a compiled program in my directory. I got his username from cat /etc/passwd. The executable does not write any file but reads a few and gives output on the ...
0
votes
1
answer
193
views
Release control from init.d script centos
I am using logstash-forwarder and starting it inside its init script with the command:
/opt/logstash-forwarder/bin/logstash-forwarder -config=/etc/logstash-forwarder -spool-size 100
This command ...
1
vote
1
answer
3k
views
echo "something" > file not working when sh script is being executed by remote PHP server
I've got a web-server with my hardcoded webpanel for Source server management and I've got my VPS on CentOS which doesn't really want to execute sh script when asked from remote server.
Web-server ...
0
votes
1
answer
172
views
CentOS : Removed /root
I have been doing experiments with CentOS and now I am in a situation.
I have added an user by mentioning his home directory as /root and then I did
userdel -rf <username>
So its does the job ...
1
vote
2
answers
5k
views
Is it possible to run a dialog/whiptail script in one TTY from another?
The origin of this question, for me, is being able to run a whiptail command in a %pre script from a kickstart file when installing a custom distribution based on Centos. However, the behaviour ...
0
votes
1
answer
482
views
How to apply "set number" to vi on root?
I'm using vi on centos 6.5 and added "set number" script to /etc/bashrc in order to look line numbers whenever boot.
It works well to show it on user login but not root.
How to apply "set number" of ...
0
votes
2
answers
561
views
Empty /var/log after running cron bash script
I wrote a little bash script and all of a sudden my /var/log folder is completely empty except for the log I created for the bash script.
This is the script I'm running every hour with cron:
#!/bin/...
1
vote
1
answer
2k
views
Associate MIME Type with Shell Script?
I want to associate any file type with a .abc extension with the following shell script:
#!/bin/bash
echo arg 1 is: $1
The .abc type files just have text, but I want to ensure that opening a file ...
206
votes
11
answers
41k
views
I accidentally typed password into bash command line
I accidentally typed my password into bash command line, mistaking the Last login: ... line for Wrong password (I was in a hurry). What do I do to cover my trace?
What I did was editing .bash_history ...
1
vote
0
answers
2k
views
execl: couldn't exec `/bin/sh'
I accidentally moved the whole bin, boot, dev and etc directory.
After moving everything back I get the following error email from various cron jobs:
execl: couldn't exec `/bin/sh'
execl: No such ...
0
votes
1
answer
5k
views
chsh doesn't change shell
I'm using CentOS 6.5, and the chsh command does not work. I've tried under my account and as root, each time using both the full argument chsh -s /bin/tcsh and using just chsh and following the ...
0
votes
3
answers
1k
views
CentOS - how to use ln command in this situation?
Create a file like the log file in CentOS, when this log file is updated, then the copy of the log file is also updated. Maybe I use this command:
ln -s logfile copy_of_logfile
Then when logfile's ...
0
votes
1
answer
204
views
Copy files from path to path same structure for each user
How to copy single file for example index.html
from source
/backup/cpbackup/daily/a1/homedir/public_html/index.html
/backup/cpbackup/daily/b2/homedir/public_html/index.html
/backup/cpbackup/daily/...
2
votes
0
answers
424
views
xdotool : close all windows except the one that is active (infront)
I would like to execute a command that will close
all windows except the one that is currently active.
i would likely to place this command in the gnome-panel
which means when i click on the button, ...