mac terminal alias set up password [closed] - bash

Closed. This question does not meet Stack Overflow guidelines. 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 8 years ago.
Improve this question
I want to create alias to reboot computer. Tried to set alias reboot='sudo reboot'. But it required to enter password. I want to know is that possible to put the password into this alias.

No, you can not put the password in the alias. sudo prevents this because it's a huge security hole.
Instead, run sudo visudo and add the line
yourusernamehere ALL=(ALL) NOPASSWD: /sbin/reboot
then your current alias will stop asking for a password and just allow the reboot.

You can create an alias like this
alias odo2='echo ROOT_PASSWD | sudo -S reboot'
Even better put all your aliases inside
~/.bash_profile
[This #2 would work if your have not changed your terminal login preferences to a different shell... Most probably your login shell would load up bash]

Related

How can I update my bash profile to include an alias? [closed]

Closed. This question does not meet Stack Overflow guidelines. 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 2 years ago.
Improve this question
I'm trying to make an alias in my bash profile, for example having python always execute python3 and other text replacements like that. How can this be done on mac?
once you're in the bash profile...
nano .bash_profile
you can add an alias like this...
alias l='ls -lah'
nano .bash_profile
That's probably the simplest way to get in to your bash profile on terminal.
add the following to your ~/.bash_profile:
alias python='python3'
Here's a step by step walk through: https://coolestguidesontheplanet.com/make-an-alias-in-bash-shell-in-os-x-terminal/
There is (or should be) a file called .bash_profile where your terminal fires up. Open it in a text editor, and enter something like
alias desktop="cd c:/users/michael/desktop"
This particular one takes me to the desktop in the terminal when I enter 'desktop'
If you create an alias for python, you should also consider creating an alias for pip.
alias pip='pip3'
Not required but will probably help you avoid problems/errors in the future.

How to reset the admin password for Ubuntu on Windows [closed]

Closed. This question does not meet Stack Overflow guidelines. 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 6 years ago.
Improve this question
I have Bash Ubuntu on Windows 10. This is enabled by turning on the Developer mode feature so the normal non-programmer would likely not need this. I need to reset the password. I must have typed it wrong (twice, somehow) when I first set it up. How can I do that?
This has been answered HERE
Copying from their answer:
In Windows command prompt change the default user to root:
lxrun /setdefaultuser root
Now Bash on Ubuntu on Windows logs you in as root without asking password
Use passwd command in Bash to change the user password:
passwd your_username
Change the default user back to your normal user in Windows command prompt
lxrun /setdefaultuser your_username

Unix user without password still needs password [closed]

Closed. This question does not meet Stack Overflow guidelines. 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 8 years ago.
Improve this question
I created a user on OS X Mavericks – dscl . -create /Users/newuser UserShell /bin/sh – without setting any password. This is confirmed by reading the user file with the dscl interactive prompt.
However, when I sudo su newuser and try to su back to root, bash prompts me for a password. I need to close the terminal and open a new window to exit the user session.
Why is that?
When you run sudo su newuser, you are effectively running as "newuser". Running su as "newuser" will require escalating to root, requiring a password.
Try just exiting the the original su session with exit or <ctrl-d>. This should return you to the original shell.

Cygwin sshd use cmd instead of bash upon login via PuTTY [closed]

Closed. This question does not meet Stack Overflow guidelines. 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 8 years ago.
Improve this question
I've finally got to the point where I can successfully SSH into my server, but commands like 'rake' and 'bundle' don't work! I'd rather be taken to cmd than bash upon login. Is there a command I can put into PuTTY's "Remote Command" box so that cmd gets loaded? I tried "-c cmd" but it just closes upon a successful connection. If I leave it out and just type 'cmd' when the bash prompt is ready it works ok. Also another thing of note is that user environment variables in Windows don't get transferred to the SSH session (like GIT_SSH).
Nothing was working, but I came across something which sort of made sense when browsing the passwd file for another problem I was having. The last part of the line indicates what is executed upon login. Originally it was /bin/bash, so I changed it to the cmd executable and it works now.
ex)
Administrator:unused:[SID-STUFF]:U-POS-SERVER\Administrator,[SID-HERE]:/cygdrive/c/Users/Administrator:/cygdrive/c/windows/system32/cmd

How to get ZSH prompt when SSHing [closed]

Closed. This question does not meet Stack Overflow guidelines. 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 9 years ago.
Improve this question
I currently have zsh and oh-my-zsh installed with homebrew on my osx workstation. Everything works fine, it is using the correct path (/usr/local/bin/zsh) and changes made in ~/.zshrc such as aliases are working.
My problem is, when I ssh into an ubuntu server, there is no zsh prompt and nothing (zsh related) in ~. Is there something I need to do in order to make zsh work on remote servers?
Thanks!
Install zsh on the remote server (e.g. apt-get install zsh)
You'll want to push (i.e. scp -rp) the following files/directories to the remote server:
~/.zshrc
~/.oh-my-zsh/
You'll need to change your remote user's default shell to zsh (e.g. run chsh /bin/zsh on the remote server)

Resources