I want to write a .sh-script that sends a message to my ejabberd-account. (the script is "called" by the apache2 standard-user "www-data").
The script should execute the following command: ejabberdctl send_message chat admin#my-domain user#my-domain "title" "my message"
However, I can't run any ejabberdctl command without "being" root. So sudo ejabberdctl is not working (in terminal or any .sh-script). I can only do sudo -s followed by ejabberdctl my-command, which doesn't work in .sh-scripts (or am I wrong?).
(I've installed ejabberd 20.07 on ubuntu 20.04 with the help of this tutorial: Install Ejabberd...)
Is there a way to run a command in a .sh-script as "real root" or to create a root-session and run the command there (like I do manually with sudo -s ...)?
Is there any solution to my problem or should I install ejabberd the "normal way"?
When ejabberd is compiled and installed from source code, it's possible to prepare it with something like
./configure -–enable-group=ejagroup
Then, you can simply create the system group ejagroup, and add the www-data user to that ejagroup.
See https://docs.ejabberd.im/admin/installation/#options
In your case, that you use the Debian package from ProcessOne, I see the tutorial mentions that you create a system account called ejabberd. Maybe you can run ejabberdctl from that account, no need to be root?
I still don't know why I can only run ejabberdctl when I'm "logged-in" as root (sudo ejabberdctl is still not working)
Is my .bashrc file wrong? (last line: PATH=$PATH:/opt/ejabberd-20.07/bin/)
Anyway, at least I can run sudo /opt/ejabberd-20.07/bin/ejabberdctl my_command with any user, like they did here: Ejabberd sbin/ejabberdctl start (No such file or directory)
Has someone else experienced this weird behavior with sudo: any_command: not found ?
Let me know if you have a more "elegant" solution to my problem.
Related
I am using OpenERP 7.0-20130811-231021 in Ubuntu. I developed a new module but when I try to install it, that module is not in the OpenERP module list. I tried the following steps:
sudo /etc/init.d/openerp start
update modules list
go to installed module and viewed the module.
It is not there when I tried this command:
sudo ./openerp-server -u modulename
It shows the following:
error: [Errno 98] Address already in use
What is causing this error and how can I fix it?
Find openerp-server process id:-
ps -ax | grep openerp-server this will give the process id and need to kill it for example 1234
Kill Process ID:-
sudo kill -9 1234
Start Sever:-
sudo /etc/init.d/openerp-server start
And update module from the GUI, Hope this will help you.
In order to see a custom module in OpenERP 7, it must first be in the addons directory.
Go to Settings > Modules > Update Modules List Click Update You must have Technical Features enabled for the user you are logged in as.
Then go to Settings > Modules > Installed Modules Remove the [Installed] filter and search for your custom module
Custom modules will not appear in Settings > Modules > Apps because that view will only display Modules/Apps that are found online.
You need to check:
1- Your openerp-server.conf in install file, in there you should check that your addons_path reference your module location
2-Check your openerp.py and make shure everything is rigth
3- You must check also your Run Configurations Parameters and specified -u and module name, this will update your module in every restart
i just installed mongopi from https://github.com/RickP/mongopi and it working correctly after doing a few adjustments mainly $ sudo chown $USER /data/db. However my mongo and mongod calls arent persistent i do PATH=$PATH:/opt/mongo/bin/ &
export PATH however this does not last on next ssh session. Also how can I make mongo initialize at startup? I did all the steps from the github repo.
For the path part of the question:
To get the path working you should put it in a script that runs every time you log in. Generally there is a rc-file for you shell in your home directory. Type
echo $SHELL
to see what shell you are running. Go to your home directory:
cd
and then open the file that is called .(your shell)rc - that is, if you are running bash, open .bashrc
nano .bashrc
add the path at the end of this file:
PATH=$PATH:/opt/mongo/bin
export PATH
For the initialization part of the question:
Download and edit this script: Mongo init.d at github
You'll need to change the value of the DEAMON at line 50. I had some other troubles, but you should probably be ok if you create a configuration file (that probably could be empty) and refer to it from line 57. Also, you need to add a mongodb user that the server should run as. You can edit this on line 95, but the default is probably a good idea.
When all this editing is done, you move the file to /etc/init.d/mongodb, like so:
sudo mv init.d /etc/init.d/mongodb
and then add it to the systems start-up routine
sudo update-rc.d mongodb defaults
(This is presuming you run debian. Other distros may have other commands to do this.)
Now, see to that you are not running mongod some other place, and control the service by
sudo service mongodb start
service mongodb status
sudo service mongodb stop
... and so on. This will also run automatically on start-up and shutdown.
I am front-end developer attempting to crossover into the world of web app development. I've come a long way in learning Javascript, and now I'm looking to toy around with frameworks.
I still have a bit to learn about using the OSX terminal, but I was hoping somebody could help me with this first stumble I'm having....
I try to install meteor using:
$ curl https://install.meteor.com | /bin/sh
Then I get the following:
Meteor 0.6.4 has been installed in your home directory (~/.meteor).
Writing a launcher script to /usr/local/bin/meteor for your convenience.
This may prompt for your password.
cp: /usr/local/bin/meteor: No such file or directory
Couldn't write the launcher script. Please either:
(1) Run the following as root:
cp ~/.meteor/tools/latest/launch-meteor /usr/bin/meteor
(2) Add ~/.meteor to your path, or
(3) Rerun this command to try again.
Then to get started, take a look at 'meteor --help' or see the docs at
docs.meteor.com.
If it's still helpful to anyone, going into /usr/local/bin, running "sudo rm meteor" then running the install gets it to work for me
Yeah try one of the three suggestions or:
sudo curl https://install.meteor.com | /bin/sh
I had the same problem heres how I fixed it!
Delete all meteor folders
In finder (cmd +shft+g)
type in "~/.meteor"
on the top of the finder window where is has the folder.meteor click and drag folder to trash
In finder (cmd +shft+g) type in "/usr/bin/meteor" then drag the meteor folder to trash
3.In /usr/ create a new folder "local" (password required) and inside "local" create a folder "bin"
Go back to terminal a run curl https://install.meteor.com | /bin/sh
I have a problem when i want to install perl module
I make " cpan" to install cpan , but i get this "
Terminal does not support AddHistory.
Your configuration suggests that CPAN.pm should use a working
directory of
/home/cyrine/.cpan
Unfortunately we could not create the lock file
/home/cyrine/.cpan/.lock
due to permission problems.
Please make sure that the configuration variable
$CPAN::Config->{cpan_home}
points to a directory where you can write a .lock file. You can set
this variable in either a CPAN/MyConfig.pm or a CPAN/Config.pm in your
#INC path;
You don't seem to have a user configuration (MyConfig.pm) yet.
i make "y"
then i got this strange message :
mkdir /home/cyrine/.cpan/CPAN: Permission denied at /usr/share/perl/5.10/CPAN/Shell.pm >line 656
Any idea please?
Thank you
The immediate cause of this problem is that you don't have write permissions on /home/cyrine/.cpan. In my experience, this is most often the result of logging in as a normal user, then running cpan for the first time on that account in a su session, causing the CPAN configuration to be created in ~cyrine (because you have cyrine's environment), but owned by root (because su has given you root's permissions). Assuming that is the case, you should be able to resolve this my suing to root, running the command chown -R cyrine.cyrine /home/cyrine/.cpan and then running cpan as user cyrine.
I have a bunch of virtual machines that I need to update from time to time. I found this VirtuaBox command
VBoxManage guestcontrol
that works great. problem is that updating requires UAC. Is there any way to bypass the UAC check
The way I found to do it quickly was to buy this software:
http://www.ntwind.com/software/hstart.html
If I had more time I would probably develop something myself. What the software does is install a scheduled task and then run the program through the scheduled task. A brief description of this can be found here:
http://www.howtogeek.com/howto/windows-vista/create-administrator-mode-shortcuts-without-uac-prompts-in-windows-vista/
If I understand correctly, you are requested to type in the root password every time, right?
If so, to bypass that by adding the command to the sudoers file, then when using the command (with sudo) it will not ask for a password but will elevate you to root right away.
To allow a specific program or shell script to run as root but without typing the password (like during boot), add to /etc/sudoers the following line:
(username) ALL = NOPASSWD: /path/to/cmd
for example:
Mac ALL = NOPASSWD: /usr/bin/vboxmanage
After doing that, when typing sudo vboxmanage you will not be ask for root password anymore.
Hope that helps!