Bower not found when Running JHipster - npm

I had some issue recently and the problem seems to be very badlty documented so I make here a post to explain it and the solution as well.
When running JHipster and do all the installation step, you may have some issue running the ./gradlew bootRun (bootRun is not necessary as it is the task by default).
If you have the following problem :
You CAN'T solve it with sudo. I don't really now why, but the console will logged you that you don't need sudo to run that (really frustrating).
You can find the solution in the comment (It seems that I have to separate the question from the answer).

The actual problem is that the file you can't run has the wrong username or group name and can't be ran due to that.
So you have to change it by the command :
chown -R
The syntax is :
chown -R Username:groupName path/of/your/file
But then the question is : How to know what to write in username and groupName ?
You have to go to your directory (where you run ./gradlew ) and type :
ls -l
It will show you all the files in the directory, with the username and group name associated.
The username is in column 3 and group name in ** column 4** .
Normally, this should be all the same here. But that's quite normal : The problematic file is not here. But you have here the name your problematic file should have.
Just run the command and this should work !

Related

How do I change permissions/ownership of .config file from "root" to me ("username")?

So I'm running into this error every time I run a command in terminal (using Visual Code Studio) while doing anything within a git repository.
Terminal Git Error Message
I did some digging and found out the owner of the .config file is "root" and not me "username" (see second screenshot)Root is owner of .config file
Do you know how to change the ownership to me so I stop getting this warning message? I ran a command I found on here "sudo chown -R $(username) .config" but it wasn't recognized, then asked me for a password and wouldn't let me type anything so I closed out of terminal.
I'm new to all this and coming from a construction background and going back to school so layman's terms would be appreciated.
Thanks in advance!
sudo chown $USER path/to/.config
is the correct command. sudo asks for your password (the same one you use to login to the $USER account); for security reasons the password isn't echoed, you just have to input it blindly and press Enter.

Ubuntu 18 Autocomplete Bug? "bash: cd: too many arguments"

Autocomplete started working bad after upgrading from ubuntu 16. If I hit tab after
git checkout src/
I get something like this:
$ git checkout src/bash: cd: too many arguments
main/ test/
Coincidentally I happened to see the same using the "test" command of gnu-coreutils:
$ ls
pom.xml src target
$ test pom.xml
bash: cd: too many arguments
Are the two things maybe connected? Unfortunately I couldn't find any bug after googling it.
I had the same issue. One of my aliases had the name test, lib or root (I don't remember which one) and it was a cd command to a folder. Renaming the alias solved the problem for me.
My latest alias with .bashrc was with using words like test and git where I was trying to change to corresponding directories. I have changed them to testdir and gitdir and restarted my computer. I don't have this -bash: cd: too many arguments error showing up now.

Hive script not running in crontab with hadoop must be in the path error

After setting Hadoop Home path and Prefix path in .bashrc and /etc/profile also im getting the same error - Cannot find hadoop installation: $HADOOP_HOME or $HADOOP_PREFIX must be set or hadoop must be in the path
If i run the script from crontab im facing this error from hive> prompt its working fine
plz help with the regarding how to solve this
Set $HADOOP_HOME in $HIVE_HOME/conf/hive-env.sh
try loading user bash profile in the script, as below,
. ~/.bash_profile
bash is included in user bash_profile and it will have user specific configurations as well.
see the similar question Hbase commands not working in script executed via crontab

PHP: Check if script is being ran with sudo or if user is not using `php`

How to make a check to find whether the script is run with sudo access or not using PHP ?
Note: this question would probably be more appropriate on Stack Overflow, even though it refers to PHP on Unix & Linux systems (privilege elevation, permissions, etc.).
You can use PHP's POSIX functions:
posix_geteuid() to get the effective user ID.
posix_getpwuid() to get user information from an UID.
Here is a little example:
<?php
$userinfo = posix_getpwuid(posix_geteuid());
echo "This script runs with " . $userinfo["name"] . "'s privileges.";
?>
Testing...
$ php myfile.php
This script is run with myuser's privileges.
$ sudo php myfile.php
This script is run with root's privileges.
By the way, since root is always UID 0, you could just check posix_geteuid() == 0.
Now, if you want to now whether the user is using the CLI (command-line) or going through the web server, have a look at this question on Stack Overflow and the php_sapi_name() function.
Another note: I'm pretty sure that running PHP scripts as root isn't the best of ideas. You may want to think again about what permissions your script really needs.
If it's purely about determining whether sudo is used, sudo puts a number of values in the environment of the command:
SUDO_COMMAND=/usr/bin/commandname
SUDO_USER=wurtel
SUDO_UID=1000
SUDO_GID=1001
These can be checked in php using the getenv() function. Of course, combine it with posix_geteuid() function to make sure you really do have elevated privileges as anyone can set those values in the environment.
Does it have to be in php only? You could chmod the php directory to only be executable by root and this should achieve the same result for you.
chmod 700 filename
chmod 700 foldername -R
-R
The -R means recursive, so any file or sub folders will get the same permissions as the parent. Use this with care.
To improve on this more you can create a 'phpadmin' user which can own the files so no other user can execute them besides root and phpadmin.
useradd phpadmin
chown phpadmin:phpadmin foldername -R
Warning
Please be very careful when using the chmod & chown commands. Make sure you are targeting the correct folder and file names before using these commands.

I am getting error ssh exit staus 1

In jenkins post build action I configured Execute shell script on remote host using ssh
ssh site 10.32.25.66, command:
cd $HOME/appsadm/bin; ./ims-carte-stop
and i again modified
cd /HOME/appsadm/bin; ./ims-carte-stop.*
I tried both these commands and Build is successful, but I see in console output in Jenkins after, that it is not executing my script. I am getting ssh exit status 1 error.
In my winscp my script (ims-carte-stop) in this location home/appsadm/bin.
Please tell me if I am doing aything wrong.
My intention is to stop my server from jenkins automatically whenever the build success.
This may be a typo in your question, but:
You said your ims-carte-stop script is in:
/home/appsadm/bin
whereas your script is doing:
cd $HOME/appsadm/bin
or
cd /HOME/appsadm/bin
Looking at the paths, I am going to assume you are using a UNIX-flavoured OS (Linux, BSD, OSX).
UNIX paths are case sensitive. Your script should be calling:
cd /home/appsadm/bin
Note that the word "home" is all small letter not capitals. Also, using $ makes it a variable, which I don't think you want.