C++ Passwd, Root Priviledges [closed] - c++

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have written a c++ script that disables or enables users within a Solaris environment. This is done by calling the passwd through
sprintf(cmd, "/usr/bin/passwd -l %s", argv[1]);
However the script is not executed by root, but by another user.
While the script executes the passwd changes are not done. Seems this is an issue with the user permission on passwd.
However it seems that only root can modify passwd. Is this true? Can something else be done? In the sense that passwd can be modified by other users?

You need root permission in order to do that.
However, you can configure sudo to allow the execution of your binary as root for a specified user.
An other solution would be to setuid the binary. However, care must be taken when doing that.

The process should have CAP_SETUID capability and user id is to be set to 0.

Related

CentOS7.8 not raise privileges to root but a strange user [closed]

Closed. This question is not about programming or software development. 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 3 days ago.
Improve this question
touch a test.sh and write following in it:
source ~/.bash_profile
chmod a+x ./test.sh
./test.sh, it prompts me to enter password, after I enter correct password, still authenticate fail.
as I write 'before' and 'after' around . ~/.bashrc, it seems that . ~/.bashrc need to be authenticated.
But why is it authenticated as daemon instead of root ? daemon is a special user(I don't know what it is used for):
PS: OS is Centos7.8

How to create an installer with InnoSetup running in only one computer to prevent unauthorized copy [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I am using Innosetup to create an installer for my application (test.exe using Qt creator). I need that my application should be running on only one machine (unauthorized copies in other computer). I don't know how to make a function in Innosetup to identify if the address IP corresponds to the authorized machine or not. Else it should not run my application.
If you are looking for an solution for anti-copy the application, you can read the SID of the PC installed, store the SID in your application. Every time your application launches, the first step is to read the SID, then compare to the initial SID, if not match, exit your application.

Installing C++ compiler at terminal on Linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I wanted to install a C++ compiler on my computer in Linux and I used fallowing code in terminal:
sudo apt-get install build-essential
After that, the terminal wanted password from me, but when I typed the password I saw this error:
Sorry, Try again!
My password wasn't wrong!
I'll assume you have rootpw off, so it wants your user password. To reset a user password, follow these steps. In summary:
Reboot
When GRUB comes up, choose an entry that includes "(recovery mode)"
Choose "Drop to root shell prompt"
Run passwd yourUsername, and follow the prompts.
Run exit.
Choose "resume normal boot".
If it were the root password, you could run passwd root instead.
Edit: If you're typing a password in the command line, no characters will appear; this way, if people are standing behind you, they will not see your password. That seems to have been the misunderstanding here. Just type the full password and hit enter, it should work.
Are you typing the password for root, or the password for your user account?
Try hitting ctrl+alt+F1, logging in as root, and typing
passwd <your_user_name>
then changing the password.
You are typing in the wrong password for the account you're trying to use, so either you need to change that account's password, or you need to figure out which account it is and use the correct one.
P.S.: check capslock. Silly as it is, there's a reason people say it.

installing VMware-Player-3.1.4-385536.x86_64.bundle .bundle Vmware Player [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
how to install VMware-Player-3.1.4-385536.x86_64.bundle ?
chmod +x VMware-Player-3.1.4-385536.x86_64.bundle
./VMware-Player-3.1.4-385536.x86_64.bundle
./VMware-Player-3.1.4-385536.x86_64.bundle: line 302: /tmp/vmis.nMJGsk/install/vmware-installer/vmware-installer: Permission denied
sed -ne'299,303p' VMware-Player-3.1.4-385536.x86_64.bundle
# Pass all options the user passed in so that the correct UI type
# gets set.
"$installer" --set-setting vmware-installer libconf "$libconf" \
--install-component "$source"/vmware-installer \
Figured this one out. It took me a while, but it was one of those silly little things that you wish you'd thought of earlier. I had /tmp mounted with the noexec flag so it couldn't run the extracted installer script from the /tmp folder.
I started bash.
Did an su
Then edited the /etc/fstab to remove the noexec option using vi.
Saved the fstab
Rebooted
Now the installer works :-)

How to code a new Windows Shell? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
How would I go about coding a new Windows Vista Shell?
Everything you need to do as shell has never been documented, so there are some issues with file change notifications etc. The basics are:
SystemParametersInfo(SPI_SETMINIMIZEDMETRICS,...MINIMIZEDMETRICS) with (undocumented?) flag 8
Register as the shell (SetShellWindow,SetProgmanWindow,ShellDDEInit,RegisterShellHook etc)
Hide welcome screen by setting a signal ("msgina: ShellReadyEvent" and "ShellDesktopSwitchEvent")
Start registry run key, start menu\startup and ShellServiceObjects
Set registry Explorer\SessionInfo
The good thing is, you are not the first to write a new shell, if you look around, you can find some obscure required info. Here is a list to get you started:
https://web.archive.org/web/2019/http://www.lsdev.org/doku.php
http://bb4win.cvs.sourceforge.net/bb4win/blackbox/Blackbox.cpp?revision=1.49&view=markup
http://xoblite.net/source/Blackbox.cpp.html
http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/
http://www.geoffchappell.com/viewer.htm?doc=studies/windows/shell/explorer/index.htm&tx=36
A good place to start would be investigating how to build a command line parser, something that can tokenize and interpret the inputs. There are tools that can help with this like ANTLR, or you might like to try building your own.
Once you've parsed the inputs you need to decide what actions to take - launching processes, piping between processes, redirecting output - and making those system calls.
If you're just after a more powerful shell rather than interested in building one, give PowerShell a try.