how delete squiggly folder in sub directory - linux

Im trying to delete folder, i dont know why it was can create..
i have already try rm -rf ~ , but it delete root folder
how to delete ~ (squiggly folder in sub directory) folder
below the path
# pwd
/root/data/xmpp-php/xmpphp
# ls -ltr
total 56
-rw-r----- 1 root root 1819 Jan 9 19:18 webclient_example.php
drwxr-xr-x 4 root root 4096 Jan 9 19:18 tests
-rw-r----- 1 root root 1647 Jan 9 19:18 cli_longrun_example_bosh.php
-rw-r----- 1 root root 2688 Jan 9 19:18 cli_longrun_example.php
drwxr-xr-x 3 root root 4096 Jan 9 19:18 XMPPHP
-rw-r----- 1 root root 1686 Jan 9 19:18 README
-rw-r----- 1 root root 18390 Jan 9 19:18 LICENSE
drwxr-xr-x 6 root root 4096 Jan 9 19:18 .svn
-rw-r----- 1 root root 637 Jan 10 00:41 ~ i want to delete this folder
-rw-r----- 1 root root 640 Jan 10 01:14 sendmessage_example.php

Try the following command:
cd /root/data/xmpp-php/xmpphp
rm -rf \~

Related

`cd` to a folder in bash script not working: No such folder [duplicate]

This question already has answers here:
Why can't I change directories using "cd" in a script?
(33 answers)
'\r': command not found [duplicate]
(3 answers)
Closed 4 years ago.
This is my entire script. it is simply to avoid having to type it again and again
cd api
rails s -p 3001 -b 0.0.0.0
cd ..
When I am in the directory of the script and run cd api it works just fine. However when I run the script via ./start_server It does not work. Here is the output of ls -al:
mendel#DESKTOP-LIKG5E5:/mnt/c/Projects/chaverim-update$ ls -al
total 8
drwxrwxrwx 0 root root 512 Apr 13 12:32 .
drwxrwxrwx 0 root root 512 Apr 5 12:40 ..
drwxrwxrwx 0 root root 512 Apr 13 12:09 api
-rwxrwxrwx 1 root root 1237 Apr 5 12:40 boxfile.yml
drwxrwxrwx 0 root root 512 Apr 8 16:54 .bundle
drwxrwxrwx 0 root root 512 Apr 8 16:54 client
drwxrwxrwx 0 root root 512 Apr 13 12:09 .git
-rwxrwxrwx 1 root root 11 Apr 5 12:40 .gitignore
-rwxrwxrwx 1 root root 1097 Apr 5 12:40 LICENSE
drwxrwxrwx 0 root root 512 Apr 5 12:40 nginx
-rwxrwxrwx 1 root root 82 Apr 5 12:40 Procfile
-rwxrwxrwx 1 root root 67 Apr 5 12:40 README.md
-rwxrwxrwx 1 root root 188 Apr 5 12:40 run_tests
-rwxrwxrwx 1 root root 28 Apr 5 12:40 start_client
-rwxrwxrwx 1 root root 41 Apr 13 12:52 start_server
drwxrwxrwx 0 root root 512 Apr 8 16:54 vendor
As you can see there is a folder called api at the top and the start_server script is set to have execution permissions.

Docker "not found" for existing file

I am using Docker to build an electron node app and I'm getting some odd behavior. The build seems successful but when I run the electron app I get a "not found" error but the file does exist. I can ls the file and cat the file but cannot source/execute the file.
$ docker -v
Docker version 17.03.1-ce, build c6d412e
Dockerfile:
FROM node:alpine
RUN mkdir -p /usr/src
WORKDIR /usr/src
COPY package.json /usr/src
RUN npm install
COPY . /usr/src
RUN npm run build:linux
ENTRYPOINT "/usr/src/docker-entrypoint.sh"
This will result in the generation of this directory:
/usr/src/app/builds/app-linux-x64
With a bunch of files including an executable named app.
/usr/src/app/docker-entrypoint.sh: line 5: ./app: not found
It does exist.
/usr/src/app/builds/app-linux-x64 # ls -lah
total 124472
drwxr-xr-x 4 root root 4.0K Apr 28 20:07 .
drwxrwxr-x 1 root root 4.0K Apr 28 20:07 ..
-rw-r--r-- 1 root root 1.0K Apr 28 20:07 LICENSE
-rw-r--r-- 1 root root 1.6M Apr 28 20:07 LICENSES.chromium.html
-rw-r--r-- 1 root root 24.3K Apr 28 20:07 blink_image_resources_200_percent.pak
-rw-r--r-- 1 root root 15 Apr 28 20:07 content_resources_200_percent.pak
-rw-r--r-- 1 root root 9.7M Apr 28 20:07 content_shell.pak
-rw-r--r-- 1 root root 9.7M Apr 28 20:07 icudtl.dat
-rw-r--r-- 1 root root 2.8M Apr 28 20:07 libffmpeg.so
-rwxr-xr-x 1 root root 19.4M Apr 28 20:07 libnode.so
drwxr-xr-x 2 root root 4.0K Apr 28 20:07 locales
-rw-r--r-- 1 root root 334.7K Apr 28 20:07 natives_blob.bin
-rw-r--r-- 1 root root 136.6K Apr 28 20:07 pdf_viewer_resources.pak
drwxr-xr-x 2 root root 4.0K Apr 28 20:07 resources
-rw-r--r-- 1 root root 970.2K Apr 28 20:07 snapshot_blob.bin
-rwxr-xr-x 1 root root 76.7M Apr 28 20:07 app
-rw-r--r-- 1 root root 159.4K Apr 28 20:07 ui_resources_200_percent.pak
-rw-r--r-- 1 root root 6 Apr 28 20:07 version
-rw-r--r-- 1 root root 58.7K Apr 28 20:07 views_resources_200_percent.pak
I can ls it:
/usr/src/app/builds/app-linux-x64 # ls -lah app
-rwxr-xr-x 1 root root 76.7M Apr 28 20:07 app
But I cannot run it:
/usr/src/app/builds/app-linux-x64 # ./app
/bin/sh: ./app: not found
I had a similar problem myself which was solved by putting sh infront of the script to run. For you it would be:
ENTRYPOINT "sh" "/usr/src/docker-entrypoint.sh"

OSX Homebrew /usr/local permisions for node

I have installed homebrew without any problems.
The problem was to install node.. I got permission errors about /usr/local directory and symlinks.
So I did
sudo chown -R myuser /usr/local
then I istalled node without problems and then I did
sudo chown -R root /usr/local
I don't remember how was the owners in first place. I just followed some suggestions from stackoverflow to change the owner of /usr/local (a voice inside me says I did bad).
So when I run
brew doctor
I got some warnings and suggestions to chown some folders in /usr/local directory, so I did them. Then when I run
brew doctor
brew update
I get no warnings or errors anymore and looks fine (there was no updates to do after all).
My directories now looks like below. Can anyone confirm if is secure like that? How should be the owners in /usr/local ? Tt's okay to have it owned by my user as they say at github? Thanks.
myuser#iMac:/usr$ ls -la
total 8
drwxr-xr-x# 12 root wheel 408B Sep 30 23:52 ./
drwxr-xr-x 30 root wheel 1.1K Jan 23 17:51 ../
drwxr-xr-x 5 root wheel 170B Aug 23 03:51 X11/
lrwxr-xr-x 1 root wheel 3B Sep 30 23:43 X11R6# -> X11
drwxr-xr-x 3 root wheel 102B Aug 27 04:17 adic/
drwxr-xr-x 1055 root wheel 35K Jan 23 17:51 bin/
drwxr-xr-x 263 root wheel 8.7K Jan 23 17:52 lib/
drwxr-xr-x 186 root wheel 6.2K Jan 23 17:51 libexec/
drwxrwxr-x 22 root admin 748B Feb 7 12:28 local/
drwxr-xr-x 243 root wheel 8.1K Jan 23 17:51 sbin/
drwxr-xr-x 45 root wheel 1.5K Sep 30 23:43 share/
drwxr-xr-x 4 root wheel 136B Sep 17 09:03 standalone/
myuser#iMac:/usr$ cd local/
myuser#iMac:/usr/local$ ls -la
total 104
drwxrwxr-x 22 root admin 748B Feb 7 12:28 ./
drwxr-xr-x# 12 root wheel 408B Sep 30 23:52 ../
drwxr-xr-x 15 myuser admin 510B Feb 7 12:56 .git/
-rw-r--r-- 1 root admin 847B Feb 6 10:48 .gitignore
-rw-r--r-- 1 root admin 1.3K Feb 6 10:48 .travis.yml
-rw-r--r-- 1 root admin 291B Feb 6 10:48 .yardopts
-rw-r--r-- 1 root admin 3.1K Feb 6 10:48 CODEOFCONDUCT.md
-rw-r--r-- 1 root admin 2.5K Feb 6 10:48 CONTRIBUTING.md
drwxr-xr-x 3 myuser admin 102B Feb 7 12:28 Cellar/
-rw-r--r-- 1 root admin 1.2K Feb 6 10:48 LICENSE.txt
drwxr-xr-x 10 myuser admin 340B Feb 7 12:28 Library/
-rw-r--r-- 1 root admin 2.4K Feb 6 10:48 README.md
-rw-r--r-- 1 root admin 23K Feb 6 10:48 SUPPORTERS.md
drwxrwxr-x 9 root admin 306B Feb 7 12:28 bin/
drwxr-xr-x 3 myuser admin 102B Feb 7 12:28 etc/
drwxr-xr-x 10 root wheel 340B Aug 3 2015 git/
drwxr-xr-x 20 root wheel 680B Dec 3 02:01 go/
drwxr-xr-x 3 myuser admin 102B Feb 7 12:28 include/
drwxr-xr-x 4 myuser admin 136B Feb 7 12:28 lib/
drwxr-xr-x 3 root wheel 102B May 15 2015 n/
drwxr-xr-x 3 myuser admin 102B Feb 7 12:28 opt/
drwxrwxr-x 5 root admin 170B Feb 7 12:28 share/
myuser#iMac:/usr/local$

Remove folder with special character on it

I accidentally created some folders with special characters. I already read the other posts in stackoverflow, but don't work. When I type the ls -la command I see
root#mycomputer:/myfolder# ls -la
drwxr-xr-x 3 root root 4096 feb 6 17:53 ,
drwxr-xr-x 70 root root 4096 feb 11 10:27 .
drwxr-xr-x 6 root root 4096 feb 11 09:16 ..
drwxr-xr-x 7 root root 4096 feb 9 22:45 (
drwxr-xr-x 3 root root 4096 feb 2 22:01 [
drwxr-xr-x 3 root root 4096 feb 6 08:11 $
drwxr-xr-x 3 root root 4096 feb 2 23:15 \
drwxr-xr-x 4 root root 4096 feb 8 10:34 &
drwxr-xr-x 5 root root 4096 feb 8 09:43 #
drwxr-xr-x 3 root root 4096 feb 6 14:41 +
drwxr-xr-x 6 root root 4096 feb 6 09:15 ?
drwxr-xr-x 4 root root 4096 feb 6 04:07 ?
drwxr-xr-x 5 root root 4096 feb 6 01:13 ?
drwxr-xr-x 3 root root 4096 feb 6 02:25 ?
drwxr-xr-x 5 root root 4096 feb 3 12:25 ?
drwxr-xr-x 4 root root 4096 feb 5 23:18 ?
I can't do anything with the ones pointed as question marks
I tried to type the command mv and then press tab and this is what I get
root#mycomputer:/myfolder# mv
,/ ▒/ 7/ h/
(/ ▒/ 8/ i/
[/ ▒/ 9/ j/
$/ ▒/
\/ ▒/
So apparently I can't rename them in order to delete them.
Any ideas?
What finally worked for me was one of the answers I found in this question:
rm all files except some
rm !(textfile.txt|backup.tar.gz|script.php|database.sql|info.txt)
If you don't need the other directories, you can just
rmdir ?
Or, use character class (supported e.g. in bash):
rmdir [^789hij] # removes all one-character directories except for 7, 9, etc.
You can also try mc or some other file manager.

CHROOT : Allowing outside access to chrooted users with mount bind

I have a chrooted user(username: clientdev) which I have jailed inside their home directory. This chroot directory is /home/clientdev/ which is owned by root.
Now I need this clientdev user to be able access the tomcat web application folder which is residing under /mnt/datadrive/tomcat/webapps.
What I have done is :
chroot the user with a public key of their own to the home
directory.
Create a folder under /home/clientdev called tomcat_ROOT and gave
the ownership to clientdev.
Now when I run the command :
mount -bind /mnn/datadrive/tomcat/webapps /home/clientdev/tomcat_ROOT
The folder disappears from the directory listing inside /home/clientdev if I login with clientdev. My root user can see it but now the desired user.
Any help would be greatly appreciated
Thanks in advance,
Peter
Output of ls -l /home/clientdev/tomcat_ROOT:
drwxr-xr-x. 6 root root 4096 Apr 11 15:07 .
drwxrwxr-x. 12 root root 4096 Apr 11 15:07 ..
drwxr-xr-x. 3 root root 4096 Apr 9 22:10 webapp1
drwxr-xr-x. 4 root root 4096 Mar 18 18:43 webapp2
drwxr-xr-x. 3 root root 4096 Apr 9 22:11 webapp3
drwxrwxr-x. 10 root root 4096 Apr 11 15:20 ROOT
Output of ls -l /home/clientdev/:
drwx------. 4 clientdev clientdev 4096 Apr 10 21:36 .
drwxr-xr-x. 7 root root 4096 Apr 10 22:07 ..
-rw-------. 1 clientdev clientdev 664 Apr 10 21:43 .bash_history
-rw-r--r--. 1 clientdev clientdev 18 Apr 23 2012 .bash_logout
-rw-r--r--. 1 clientdev clientdev 176 Apr 23 2012 .bash_profile
-rw-r--r--. 1 clientdev clientdev 124 Apr 23 2012 .bashrc
drwx------. 2 clientdev clientdev 4096 Apr 10 19:20 .ssh
drwxr-xr-x. 2 clientdev clientdev 4096 Apr 10 21:34 tomcat_ROOT

Resources