The web server not permitted for chmod under WSL Ubuntu - permissions

I use Ubuntu 18 as WSL and everything was running well. Today I run the apache and started the application. When the app tried to perform chmod() on a file which was submited through form inside the folder project (I use Laravel), I received the following error:
chmod(): Operation not permitted
I have notice that this error happen when I try running chmod() from web server (www-data user). In the cli I dont have problems.
From other posts over the net, I understand that Windows has some changes regarding WSL permissions and drive mounts. But I didnt get answer or didnt succeed to resolve that issue.

sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata
Reference: https://github.com/Microsoft/WSL/issues/3172#issuecomment-389157376

sudo umount /mnt/c
sudo mount -t drvfs C: /mnt/c -o metadata,uid=1000,gid=1000,umask=22,fmask=111
did the trick for me.
Ref: https://devblogs.microsoft.com/commandline/chmod-chown-wsl-improvements/

Related

unable to chown files or directories from cifs/smb mount

Looking at several resources I have tried a variety of unsuccessful mount commands to try to be able to chown on a mounted smb/cifs share. My current iteration looks like this
sudo mount -t cifs //192.168.0.1/g /mnt/network -o user=user,uid=1001,gid=1001,vers=1.0,file_mode=0777,dir_mode=0777
followed by
sudo chown 1001:1001 /mnt/network/storage
This produces the following error that I can't seem to get around
chown: changing ownership of '/mnt/network/storage': Permission denied
I've tried gid=0,uid=0 anduser=root
Any insight into what I'm doing wrong or how to make this work would be much appreciated as so far what I've found online doesn't work, Thanks in advance!
I am running on ubuntu 21.04 and some raspberry pi's also running ubuntu (trying to access the same mounted directory which is on an external ssd)

chown: invalid user: ‘nfsnobody’ in fedora 32 after install nfs

I am install nfs using this command in fedora 32:
sudo dnf install nfs-utils
and then I create a dir to export storage:
[dolphin#MiWiFi-R4CM-srv infrastructure]$ cat /etc/exports
/home/dolphin/data/k8s/monitoring/infrastructure/jenkins *(rw,no_root_squash)
now I could mount this dir with root user like this:
sudo mount -t nfs -o v3 192.168.31.2:/home/dolphin/data/k8s/monitoring/infrastructure/jenkins /mnt
now I want to make a step forward to make it it avaliable to any user from any ip(the client could mount nfs without using sudo), so I first try to chown of this folder:
chown 777 jenkins
and then I want to make this jenkins folder group and user to nfsnobody:
[dolphin#MiWiFi-R4CM-srv infrastructure]$ chown -R nfsnobody jenkins
chown: invalid user: ‘nfsnobody’
and I do not find any nfsnobody content from /etc/passwd. what should I do to fix invalid user: ‘nfsnobody’ problem? should nfs-util added it automatically?
Right now nobody used by default probably after RedHat/Centos versions 8
You can simply use
chown -R nobody jenkins
Or
Change it from /etc/idmapd.conf
[Mapping]
Nobody-User = nfsnobody
Nobody-Group = nfsnobody
To put the changes into effect restart the rpcidmapd service and remount the NFSv4 filesystem:
service rpcidmapd restart
mount -o remount /nfs/mnt/point
On Red Hat Enterprise Linux 6, if the above settings have been applied and UID/GID’s are matched on server and client and users are still being mapped to nobody:nobody then a clearing of the idmapd cache may be required.
# nfsidmap -c

Running "screen" without additional permissions on WSL

I'm trying to run the "screen" utility on Windows Subsystem for Linux on Windows 10 (Version 1703, OS Build 15063.483).
It seems that I need additional permissions to run it (it works if I "sudo" it), but I don't understand why that is necessary.
What is the recommended way to set this up?
Is there some reason why this isn't the default set up?
$ screen
Cannot make directory '/var/run/screen': Permission denied
From an answer on SuperUser I discovered that you have to run
sudo /etc/init.d/screen-cleanup start
Then screen works fine for me.
EDIT: after installing Ubuntu 20.04 the problem went away (*).
As Krease pointed out, the best solution is the one described in this SuperUser post.
Add the following to your .bashrc:
export SCREENDIR=$HOME/.screen
[ -d $SCREENDIR ] || mkdir -p -m 700 $SCREENDIR
See also issue 1245 on github.
--
(*) now this warning comes up, but seems harmless:
sleep: cannot read realtime clock: Invalid argument
sudo screen # which creates dir /var/run/screen
chmod 777 /var/screen # so that non-root users can create their own screen dir in this dir.

OpenfireHome - Home not found

I have xmpp server (openfire_3.9.3) that is running on my ubuntu Ubuntu 14.04.1 LTS.
I have installed openfire by following given steps
1. $ sudo tar -zxvf openfire_x_x_x.tar.gz
2. $ sudo mv openfire /opt
then I moved to openfire bin directory to start openfire as
$ cd /opt/openfire/bin
$ sudo ./openfire start
then during setup through admin console always I am getting the given error
Home not found. Define system property "openfireHome" or create and add the openfire_init.xml file to the classpath
where I need to set openfireHome ? or how can i fixed it out ?
Well it seems your user account might have permissions issue. Can't you keep openfire in your home and try to run it from there and share results?
For me, it's a permissions issue.
I'm using server(Openfire 4.7.0, build e020f58) on my local computer (macOS Monterey 12.1 (21C52)).
My SOLUTION is:
sudo chmod -R 777 /usr/local/openfire

Screen "Must be connected to a Terminal."

I'm on a Debian OS.
I'm trying to use screen under a SSH session. But when I'm trying to run the command
screen
the shell answer me :
Must be connected to a Terminal.
If I enter
tty
it answer me :
Not a tty
I don't know why and I try
ssh -t login#server
it doesn't work..
Please help me I really need this !
Thanks
EDIT :
I read this topic but it still doesn't work
I had the same problem. If you get this error while in a chroot, here is what helped me:
(run these commands from outside the chroot)
$ sudo mount -o bind /dev /home/chroot/dev
$ sudo mount -t proc proc /home/chroot/proc
$ sudo mount -t devpts devpts /home/chroot/dev/pts
/home/chroot being the path to your chroot, obviously. Update above commands accordingly.
source: http://www.howtoforge.com/forums/showthread.php?t=23583#post128768
(see also http://forums.gentoo.org/viewtopic-t-433006-start-0.html)
Try the following:
getty tty
...and then relaunch:
screen
If you don't have getty, you could try installing it:
apt-get install getty