Error applying chroot to group (groupmod: group 'www' does not exist) [closed] - linux

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
So I am trying to chroot all the users who are in group www to the directory /var/www. But I every time I try to do that, it comes back saying the group doesn't exist. (even though the group does exist)
[root#server var]# cat /etc/fedora-release
Fedora release 26 (Twenty Six)
[root#server var]# groupadd -r www
[root#server var]# groupmod -R /var/www www
groupmod: group 'www' does not exist
[root#server var]# ls -la
drwxrwxrwx. 5 root www 46 Jul 12 06:44 www
As you can see the error message is less than helpful. I have looked around on stackoverflow but haven't come across an answer to this specific question yet.
Can anyone shed some light on what I am doing wrong?

That is not what groupmod -R does. What it means is that the groupmod program will chroot into the directory, and then do everything. It’s intended for when you have one system mounted inside another, such as if you booted from a live USB drive to make changes to a broken system.
Once groupmod has run chroot, it looks in the /var/www/etc/group file to figure out what group ID www corresponds to, which of course fails because if your system is at all sanely set up you don’t have a var/www/etc/group file.
I do not know how to make sure all processes by a specific user run in a chroot, and I don’t think that’s the right way to achieve your goal. If a program is chrooted into /var/www, it doesn’t have access to any of the utilities it might expect, like the web server executable. Instead, I would look at the documentation of your web server and see if it supports this directly, or see if you can get a custom mount namespace using systemd.

Related

`fbcon/cursor_blink` permissions reset at reboot [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last year.
Improve this question
Context
I need to stop the cursor from blinking on an external screen of my raspberry-pi in order to display a home-made interface on /dev/fb0.
For this purpose I created a group cursor_blink in which I put my user and changed the permissions of the file /sys/class/graphics/fbcon/cursor_blink as follow:
chown root:cursor_blink /sys/class/graphics/fbcon/cursor_blink
chmod 664 /sys/class/graphics/fbcon/cursor_blink
So my user in the group cursor_blink can write 1 or 0 to display and hide the cursor from the screen.
Problem
I had this working, but reinstalling it on another system makes that this file is now reset to the default permissions every time I reboot, the mode becomes again 600 and the owner root:root after reboot instead of 660 and root:cursor_blink
It seems that the file is recreated (some digging in the last edit times with stat corroborate this element).
Question
Is there a way to keep the permissions as set, and prevent them of being reset ?
For the moment the solution I found is to add a crontab task to correct the permissions at boot:
crontab -e
# ...
# add this line at the end of the file :
#reboot chown root:cursor_blink /sys/class/graphics/fbcon/cursor_blink && \
chmod 664 /sys/class/graphics/fbcon/cursor_blink
Prerequisite: The group cursor_blink should be created and the user should be added to it before: usermod -a -G user cursor_blink.
If you have a better solution, feel free to add.

Got an error while executing bash commands on remote ubuntu machine "no tty present and no askpass program specified" [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 7 years ago.
Improve this question
I'm running a bash script to execute a command on a remote host. Here is the command:
ssh ppuser#10.101.5.91 "sudo mv /tmp/$2.tar.gz $1"
$1 and $2 are command line arguments. But while executing I'm getting this error : no tty present and no askpass program specified.
Hope you will help me, any help would be greatly appreciated. Thank You.
Somewhere in your sudoers file you have following
Defaults requiretty
Just comment this line - remove it. Or
Defaults !requiretty
For specific program name you can also attempt following:
Defaults </path to program> requiretty
change it to
Defaults </path to program> ! requiretty
Specific to user you can add
Defaults:username !requiretty
Adding What already have been specified in comment,
For the same you will have to
user-name ALL=(ALL) NOPASSWD: ALL
Its for passwordless sudo
Looks like you are invoking sudo, and it is not working because it doesn't have a tty bound. add
"Defaults visiblepw"
in sudoers file enables sudo even if a console doesn't allocate a tty. Use visudo on the remote machine to add this and see if this helps.
Try this command
sshpasss -p password ssh ppuser#10.101.5.91 "sudo mv /tmp/$2.tar.gz $1"

Loging with SSH with a different user, shows no current path [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I am trying to get a server up and running, there is no problem when I am using my root user, however when I created a new user and I log in with him instead of getting
user#internet:/$
I am only geting $ and I can't see the folder in which I am.
The server is running ubuntu if that helps.
Your new user is probably using a different shell. You can check by typing $0 at the prompt in each.
It sounds like root is using bash and your new user is using sh, but do the above to check.
If you want to modify the login shell for your new user, use usermod with the -s flag:
usermod user -s /bin/bash
The above would set the default shell to bash.
It's because your user runs sh as default shell.
Run as root:
chsh -s /bin/bash your_user
And login again.

real estate linux back up solution [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 5 years ago.
Improve this question
I did a lot of research..but I couldnt find what I exactly want. Can anyone have any/some knowledge regarding how a real estate company backup strategy should be. I mean, there are different backup types such as full, incremental and differential backups.
Which solution(s) a real estate company should use to backup its resources and how frequently (daily, weekly, etc)?
assume that they have linux servers...
many thanks..
This belongs to serverfault, However you need to provide more details.
You should run incremental daily backups and a weekly fully backup.
for MySQL databases check : http://dev.mysql.com/doc/refman/5.1/en/backup-methods.html
for other files you can use rsync with hard copies.
Check this TLDPhowto and LJ article
Concider using encryption on the backup drive, either full disk using dmcrypt or if you use tar/cpio pipe it to openssl (ex : tar -xf - path1 path2 | openssl enc -aes-128-cbc -salt > backup.$(date --iso).tgz.aes
Example daily rsync backup script:
#!/bin/sh
BACKUP_DIR=/mnt/backups/
BACKUP_PATHES="/var /home"
cd ${BACKUP_DIR}
rm -rf backup.5 backup.5.log.bz2 &>/dev/null
recycle() {
i=$1; y=$(($i+1))
b=${2-backup}
mv "${b}.$i" "${b}.$y" &>/dev/null
mv "${b}.$i.log.bz2" "${b}.$y.log.bz2" &>/dev/null
}
recycle 4
recycle 3
recycle 2
recycle 1
recycle 0
OPTS="--numeric-ids --delete --delete-after --delete-excluded"
nice -n20 ionice -c2 -n2 rsync -axlHh -v --link-dest=../backup.1 ${OPTS} ${BACKUP_PATHES} backup.0/ --exclude-from=/root/.rsync-exclude 2>&1 | bzip2 -9 > backup.0.log.bz2
cd /root &>/dev/null

Force unmount of NFS-mounted directory [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
I have an NFS-mounted directory on a Linux machine that has hung. I've tried to force an unmount, but it doesn't seem to work:
$ umount -f /mnt/data
$ umount2: Device or resource busy
$ umount: /mnt/data: device is busy
If I type "mount", it appears that the directory is no longer mounted, but it hangs if I do "ls /mnt/data", and if I try to remove the mountpoint, I get:
$ rmdir /mnt/data
rmdir: /mnt/data: Device or resource busy
Is there anything I can do other than reboot the machine?
You might try a lazy unmount:
umount -l
If the NFS server disappeared and you can't get it back online, one trick that I use is to add an alias to the interface with the IP of the NFS server (in this example, 192.0.2.55).
Linux
The command for that is something roughly like:
ifconfig eth0:fakenfs 192.0.2.55 netmask 255.255.255.255
Where 192.0.2.55 is the IP of the NFS server that went away. You should then be able to ping the address, and you should also be able to unmount the filesystem (use unmount -f). You should then destroy the aliased interface so you no longer route traffic to the old NFS server to yourself with:
ifconfig eth0:fakenfs down
FreeBSD and similar operating systems
The command would be something like:
ifconfig em0 alias 192.0.2.55 netmask 255.255.255.255
And then to remove it:
ifconfig em0 delete 192.0.2.55
man ifconfig(8) for more!
Try running
lsof | grep /mnt/data
That should list any process that is accessing /mnt/data that would prevent it from being unmounted.
I had the same problem, and
neither umount /path -f,
neither umount.nfs /path -f,
neither fuser -km /path,
works
finally I found a simple solution >.<
sudo /etc/init.d/nfs-common restart, then lets do the simple umount ;-)
Your NFS server disappeared.
Ideally your best bet is if the NFS server comes back.
If not, the "umount -f" should have done the trick.
It doesn't ALWAYS work, but it often will.
If you happen to know what processes are USING the NFS filesystem,
you could try killing those processes and then maybe an unmount would work.
Finally, I'd guess you need to reboot.
Also, DON'T soft-mount your NFS drives. You use hard-mounts to guarantee
that they worked. That's necessary if you're doing writes.
Couldn't find a working answer here; but on linux you can run "umount.nfs4 /volume -f" and it definitely unmounts it.

Resources